Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
120
XamGrid with 'cascading' ComboBoxColumn 's
posted

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>

<DataTemplate>

<TextBox Text="{Binding PhoneNumber, Mode=TwoWay}" HorizontalAlignment="Left" VerticalAlignment="Center" />

</DataTemplate>

</ig:TemplateColumn.EditorTemplate>

</ig:TemplateColumn>

<ig:TemplateColumn Key="SubscriberFullName" HeaderText="Asset Subscriber" HorizontalContentAlignment="Left" IsReadOnly="False">

<ig:TemplateColumn.ItemTemplate>

<DataTemplate>

<TextBlock Text="{Binding SubscriberFullName}" Foreground="Green" HorizontalAlignment="Left" VerticalAlignment="Center" />

</DataTemplate>

</ig:TemplateColumn.ItemTemplate>

<ig:TemplateColumn.EditorTemplate>

<DataTemplate>

<TextBox Text="{Binding SubscriberFullName, Mode=TwoWay}" HorizontalAlignment="Left" VerticalAlignment="Center" />

</DataTemplate>

</ig:TemplateColumn.EditorTemplate>

</ig:TemplateColumn>

<ig:TemplateColumn Key="CurrCarrPhoneNumber" HeaderText="Carrier Phone No" HorizontalContentAlignment="Left" IsReadOnly="False">

<ig:TemplateColumn.ItemTemplate>

<DataTemplate>

<TextBlock Text="{Binding CurrCarrPhoneNumber, Converter={StaticResource PhoneNumberFormatter}}" Foreground="Blue" />

</DataTemplate>

</ig:TemplateColumn.ItemTemplate>

</ig:TemplateColumn>

<ig:TemplateColumn Key="CurrCarrSubscriberFullName" HeaderText="Carrier Subscriber" HorizontalContentAlignment="Left" IsReadOnly="False">

<ig:TemplateColumn.ItemTemplate>

<DataTemplate>

<TextBlock Text="{Binding CurrCarrSubscriberFullName}" Foreground="Blue" />

</DataTemplate>

</ig:TemplateColumn.ItemTemplate>

</ig:TemplateColumn>

  <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"

IsFilterable="True"

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>

Parents Reply Children
No Data