I have an editable XamGrid with 3 ComboBoxColumn columns. They are all loading fine. However, I need to have the second one filter based on the selection of the first one and the third one filtered based on the second one. So instead of the second combobox showing all 9 items it should be a subset of those items based on the value selected in the first one.
I tried implementing this in the code-behind by handling the CellEnteredEditMode event then if the cell being edited is the first ComboBoxColumn, I then add a SelectionChanged event which then filters the second ComboBoxColumn by setting its ItemsSource property with the appropriately filtered values.
This sort of works however is causing some unexpected behaviour as well as a Null Rerenece error in the XamGrid logic whenever a new XamGrid row is selected. The call stack to this error is:
at Infragistics.Controls.Grids.XamGrid.ExitEditModeInternal(Boolean cancel, ExitEditModeBehavior exitEditModeBehavior) at Infragistics.Controls.Grids.XamGrid.ExitEditModeInternal(Boolean cancel) at Infragistics.Controls.Grids.XamGrid.SetActiveCell(CellBase cell, CellAlignment alignment, InvokeAction action, Boolean allowSelection, Boolean setFocus, Boolean scrollIntoView) at Infragistics.Controls.Grids.XamGrid.SetActiveCell(CellBase cell, CellAlignment alignment, InvokeAction action, Boolean allowSelection, Boolean scrollIntoView) at Infragistics.Controls.Grids.XamGrid.SetActiveCell(CellBase cell, CellAlignment alignment, InvokeAction action, Boolean allowSelection) at Infragistics.Controls.Grids.Cell.OnCellMouseDownImpl(Boolean& handled) at Infragistics.Controls.Grids.Cell.OnCellMouseDown(MouseEventArgs e) at Infragistics.Controls.Grids.XamGrid.OnGridMouseLeftButtonDown(MouseButtonEventArgs e) at Infragistics.Controls.Grids.XamGrid.XamGrid_MouseLeftButtonDown(Object sender, MouseButtonEventArgs e) at MS.Internal.CoreInvokeHandler.InvokeEventHandler(UInt32 typeIndex, Delegate handlerDelegate, Object sender, Object args) at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, Int32 actualArgsTypeIndex, String eventName, UInt32 flags)
I suspect I am taking the wrong approach to this. Any help in solving this requirement would be greatly appreciated,
Cliff.
I am currently using version 13.1 / VS2013.
XAML code (snippet) :
<UserControl.Resources>
<csWeb:AssetMgmtContext x:Key="amDeviceContext" />
</UserControl.Resources>
<ig:XamGrid Name="gridAMDeviceList" AutoGenerateColumns="False" ItemsSource="{Binding Source={StaticResource amDeviceContext}, Path=AMDevices}" CellEnteredEditMode="gridAMDeviceList_CellEnteredEditMode" CellExitedEditMode="gridAMDeviceList_CellExitedEditMode" >
<ig:XamGrid.EditingSettings>
<ig:EditingSettings AllowEditing="Row"
IsMouseActionEditingEnabled="SingleClick"
IsOnCellActiveEditingEnabled="True" />
</ig:XamGrid.EditingSettings>
<ig:XamGrid.Columns>
<ig:TextColumn HeaderText="Serial No/IMEI" Key="SerialNo" Width="Auto" IsReadOnly="False" />
<ig:TextColumn HeaderText="SIM" Key="SIMId" Width="Auto" IsReadOnly="False" />
<ig:TemplateColumn Key="PhoneNumber" HeaderText="Asset Phone No" HorizontalContentAlignment="Left" IsReadOnly="False">
<ig:TemplateColumn.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding PhoneNumber, Converter={StaticResource PhoneNumberFormatter}}" Foreground="Green" HorizontalAlignment="Left" VerticalAlignment="Center" />
</DataTemplate>
</ig:TemplateColumn.ItemTemplate>
<ig:TemplateColumn.EditorTemplate>
<TextBox Text="{Binding PhoneNumber, Mode=TwoWay}" HorizontalAlignment="Left" VerticalAlignment="Center" />
</ig:TemplateColumn.EditorTemplate>
</ig:TemplateColumn>
<ig:TemplateColumn Key="SubscriberFullName" HeaderText="Asset Subscriber" HorizontalContentAlignment="Left" IsReadOnly="False">
<TextBlock Text="{Binding SubscriberFullName}" Foreground="Green" HorizontalAlignment="Left" VerticalAlignment="Center" />
<TextBox Text="{Binding SubscriberFullName, Mode=TwoWay}" HorizontalAlignment="Left" VerticalAlignment="Center" />
<ig:TemplateColumn Key="CurrCarrPhoneNumber" HeaderText="Carrier Phone No" HorizontalContentAlignment="Left" IsReadOnly="False">
<TextBlock Text="{Binding CurrCarrPhoneNumber, Converter={StaticResource PhoneNumberFormatter}}" Foreground="Blue" />
<ig:TemplateColumn Key="CurrCarrSubscriberFullName" HeaderText="Carrier Subscriber" HorizontalContentAlignment="Left" IsReadOnly="False">
<TextBlock Text="{Binding CurrCarrSubscriberFullName}" Foreground="Blue" />
<ig:ComboBoxColumn Key="DeviceStatusId" Width="140" HorizontalContentAlignment="Stretch"
SelectedValuePath="DeviceStatusId"
DisplayMemberPath="StatusName"
HeaderText="Device Status"
IsFilterable="True"
ItemsSource="{Binding Source={StaticResource amDeviceContext}, Path=DeviceStatus}"/>
<ig:ComboBoxColumn Key="DeviceStateId" Width="140" HorizontalContentAlignment="Stretch"
SelectedValuePath="DeviceStateId"
DisplayMemberPath="StateName"
HeaderText="Device State"
ItemsSource="{Binding Source={StaticResource amDeviceContext}, Path=DeviceStates}" />
<ig:ComboBoxColumn Key="DeviceConditionId" Width="140" HorizontalContentAlignment="Stretch"
SelectedValuePath="DeviceConditionId"
DisplayMemberPath="Description"
HeaderText="Device Condition"
ItemsSource="{Binding Source={StaticResource amDeviceContext}, Path=DeviceConditions}"/>
<ig:ComboBoxColumn Key="DeviceTypeId" Width="100" HorizontalContentAlignment="Stretch"
SelectedValuePath="DeviceTypeId"
DisplayMemberPath="Name"
HeaderText="Device Type"
EditorDisplayBehavior="Always"
ItemsSource="{Binding Source={StaticResource amDeviceContext}, Path=DeviceTypes}"/>
</ig:XamGrid.Columns>
</ig:XamGrid>
Hello Cliff,
Thank you for your post.
I have been looking into your code snippet that you have provided and it seems that you have used Services. If you do, what I can suggest is to take a look at the following forum thread :
http://www.infragistics.com/community/forums/t/47433.aspx ,
where you can find a sample with XamGrid and Cascading ComboBox. In order to be able to further investigate your issue would you please provide me with a sample application, where I can reproduce it.
Looking forward to hearing from you.
I am just checking your progress on the issue that you are having.
If you require any further assistance please do not hesitate to ask.
Hi Zhivko,
Based on the sample/thread you had posted (which I had not come across) the solution provided there worked for me. The key was using a converter to do the filtering of the combobox items (ItemsSource) and not using the combobox's selection change events.
Thank you for your help!
Thank you for your feedback.
I am very glad that the forum thread I have suggested was helpful for you.
Please let me know if you need any further assistance on this matter.