Hi,
I am using a XamGrid with a TemplateColumn. This column has an header template like this :
<ig:TemplateColumn.HeaderTemplate> <DataTemplate> <StackPanel Orientation="Horizontal"> <sdk:Label Content="Produit" Margin="0,0,5,0"/> <Button x:Name="btnProduitsServices" Content="+" Margin="0,0,10,0" DataContext="{Binding GestionBDCViewModel, Source={StaticResource Locator}}" Click="btnProduitsServices_Click" IsEnabled="{Binding AccessibiliteBtnProduitsServices, Mode=OneWay}"/> </StackPanel> </DataTemplate> </ig:TemplateColumn.HeaderTemplate>
The button opens a ChildWindow. Then, when I click on the button, the XamGrid pass on Edit Mode. If I click a second time on the button, the ChildWindow is correctly opened.
Is there a way to open the ChildWindow, even if the XamGrid is not on Edit Mode (in my case on the first click)?
Thanks for your help,
Olivier
I have a work-around for this, which focuses the xamGrid on load and in RowEnteringEditMode cancels the event if the xamgrid ActiveItem is null. In the XamGrid Loaded event handler:
xamGrid.Focus();xamGrid.ExitEditMode(true);xamGrid.UpdateLayout();
The in the RowEnteringEditMode handler:
var xamGrid = sender as XamGrid; if (xamGrid != null) { if (xamGrid.ActiveItem == null) { e.Cancel = true; } }
Thanks Nikolay,
But my real problem is the Clicked Event : it is never raised when I click on my button.
--
You can call the ExitEditMode method of the XamGrid in ColumnResizing event handler.
HTH
I've noted something : when I resize a column, the EditMode is raised too.
This behavior makes me crazy !
Can anybody help me ?
Hi Darrell,
Thanks for reply.
You're right : with the Editings Settings of your sample (AllowEditing="Cell" IsMouseActionEditingEnabled="SingleClick"), it works fine.
But I need to enable Keyboard navigation on my XamGrid (with Tab key). So, here is my Editing Settings :
<my:XamGrid.EditingSettings> <ig:EditingSettings AllowEditing="Cell" IsMouseActionEditingEnabled="SingleClick" IsOnCellActiveEditingEnabled="True"/>
</my:XamGrid.EditingSettings>
Then in this case, a click on the button raises Edit Mode and don't raise the MouseClicked event.
If I set the AllowEditing property to "Row", a click on the button raises Edit Mode AND the MouseClicked event.
In fact when I click on the button, the behavior that I am waiting for is the following :
If we are in Edit Mode, the ChildWindow is opened and the XamGrid stay in Edit Mode.
Else the ChildWindow is opened and the XamGrid stay in Read Mode.