Hi
I defined in the tabcontrol datagrid as item, you can see in the following code snippet.
<Grid Margin="5,0,5,0"> <igWindows:XamTabControl Name="_xamTabControl" ItemsSource="{Binding AutoLogins}" Theme="Metro" AllowTabClosing="False" TabItemCloseButtonVisibility="WhenSelectedOrHotTracked" SelectionChanged="_xamTabControl_OnSelectionChanged"> <igWindows:XamTabControl.ItemContainerStyle> <Style TargetType="{x:Type igWindows:TabItemEx}" BasedOn="{x:Static igThemes:PrimitivesMetro.TabItemEx}"> <Setter Property="Header" Value="{Binding Server}" /> </Style> </igWindows:XamTabControl.ItemContainerStyle> <igWindows:XamTabControl.ContentTemplate> <DataTemplate> <igDp:XamDataGrid DataSource="{Binding Logins}" IsGroupByAreaExpanded="False" GroupByAreaLocation="None" GroupByAreaMode="DefaultFieldLayoutOnly" RecordDeactivating="DataPresenterBase_OnRecordActivated" LostFocus="_dataGrid_OnLostFocus"> <igDp:XamDataGrid.FieldLayoutSettings> <igDp:FieldLayoutSettings AddNewRecordLocation="OnBottom" AllowAddNew="True" AllowDelete="True" /> </igDp:XamDataGrid.FieldLayoutSettings> <igDp:XamDataGrid.FieldSettings> <igDp:FieldSettings AllowResize="False" LabelWidth="200" LabelTextAlignment="Center" /> </igDp:XamDataGrid.FieldSettings> </igDp:XamDataGrid> </DataTemplate> </igWindows:XamTabControl.ContentTemplate> </igWindows:XamTabControl> </Grid>
My question is, how can I get the XamDataGrid object within _xamTabControl_OnSelectionChanged event. What I want to do is to validate, if any datarecord in the xamdatagrid is empty.
Thanks
Hi Jean-Pascal,
You should perform your validation directly on the data source rather than going through the XamDataGrid. Since you are using the ItemsSource of the tab control, each tab item's DataContext should be an instance of the items in your AutoLogins collection. From there you can get the Logins collection and validate the data inside.
If you must get the XamDataGrid from code, you can use the Infragistics.Windows.Utilities class to get the child UI elements of the TabItemEx element. GetDescendentFromType should do the trick.
Let me know if you have any further questions on this matter.
It still in work.
I will let you know.
Haven't heard from you in a while. Do you still require assistance on this issue?
Are you still working on this?