Hi ,
I have defined one XamGrid with ComboBoxColumn.
<ig:XamGrid x:Name="ManageRecipeStateGrid" AutoGenerateColumns="False" ColumnWidth="*" ItemsSource="{Binding ManageRecipeStateResults}">
<ig:XamGrid.GroupBySettings>
<ig:GroupBySettings AllowGroupByArea="Hidden" GroupByOperation="MergeCells" />
</ig:XamGrid.GroupBySettings>
<ig:XamGrid.Columns>
<ig:TextColumn Key="RecipeKey" Visibility="Collapsed" />
<ig:TextColumn Key="MandatoryCriteriaList" HeaderText="Recipe" IsReadOnly="True" >
</ig:TextColumn>
<ig:TextColumn Key="RecipeVersion" HeaderText="Version" IsReadOnly="True">
<ig:TextColumn Key="PreviousRecipeState" Visibility="Collapsed" />
<ig:ComboBoxColumn Width="120" HorizontalContentAlignment="Stretch"
ItemsSource="{Binding Source={StaticResource optionList}}" Key="CurrentRecipeState"
SelectedValuePath="State"
DisplayMemberPath="State"
AllowEditingValidation="True" HeaderText="Recipe State">
</ig:ComboBoxColumn>
<ig:CheckBoxColumn Key="IsPreserved" HeaderText="Preserve Recipe">
</ig:CheckBoxColumn>
</ig:XamGrid.Columns>
<ig:XamGrid.EditingSettings>
<ig:EditingSettings AllowEditing="Hover" />
</ig:XamGrid.EditingSettings>
</ig:XamGrid>
Now I want to handle the event whenever I change the item selection in ComboBoxColumn. How I can handle this ?
Hello,
Thank you for your post. I have been investigating how you can handle the selection changed event of the ComboBoxColumns and since the column is using a ComboBox as an editor when the cell is in edit mode, you can handle the SelectionChange event of the ComboBox. To do that, you can handle the CellEnteredEditMode event of the XamGrid and if the cell is of the ComboBoxColumn you can handle the SelectionChanged event. Here is an example for that:
private void ManageRecipeStateGrid_CellEnteredEditMode(object sender, Infragistics.Controls.Grids.EditingCellEventArgs e) { if (e.Cell.Column.Key.Equals("CurrentRecipeState")) { (e.Cell.Control.Content as ComboBox).SelectionChanged += new SelectionChangedEventHandler(MainWindow_SelectionChanged); } } void MainWindow_SelectionChanged(object sender, SelectionChangedEventArgs e) { //Do Something }
Another approach that you can use is creating a TemplteColumn instead of a ComboBoxColumn and in the EidorTemplate you can add a XamComboEdior and handle the SelectedItemChanged event. I have created a sample application for you, based on the code snippet that you have provide, which implements the mentioned approach.
Please let me know if you need any further assistance on the matter.
Sincerely,
Krasimir
Developer Support Engineer
Infragistics
www.infragistics.com/support
Hi,
How to select a selecteditem from combobox.
combobox.sleecteditem properties is not availablethen how we can store the sleecteditem to sql table?
can u give any idea?
thanks
In SelectedItemChanged event I want to handle a scenario where I want to restrict selection of some element in drop down. Eg . If State 1 is selected and now if user tries to select State 5 he should not be allowed to select state 5 and a message or tooltip should be displayed saying that you can change from State1 to State5. Also how can I access the active record of the grid in SelectedItemChanged event.
Can you please help on this.