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
2915
how to add SelectedItemChanged event in XamGrid with ComboBoxColumn
posted

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>

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

Parents
No Data
Reply
  • 30945
    Offline posted

    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

    SelectedItemChangedOnComboColumn.zip
Children