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
30
Using GetBindingExpression on a XamMultiColumnComboEditor
posted

I'm swapping out the standard Windows' ComboBox to Infragistics' XamMultiColumnComboEditor throughout my application.  However, I'm  having an issue with a few of them.  On each of these that I'm having a problem with, I have a SelectionChanged event with the following statement:

BindingExpression be = sender.GetBindingExpression(System.WIndows.Controls.Primitives.Selector.SelectedValueProperty);

With the standard Windows' ComboBox, this works fine.  However, I'm unable to find an equivalent for the XamMultiColumnComboEditor.  Does the XamMultiColumnComboEditor control support this?  If so, is there any way someone can provide a code sample or point me in the direction where this capability is explained and how to properly use it with said control?  Thanks.

Parents
No Data
Reply
  • 2680
    Verified Answer
    Offline posted

    Hi Chris,

    Thank you for contacting Infragistics Developer Support!

    I have been looking into your question and I believe you will find the Performing Selection topic of our documentation quite informative on the matter. 

    There you will find details on the exposed API regarding selection in the XamMultiColumnComboEditor.

    For one thing, the combo exposes a SelectionChanged event and a SelectedItems collection, which has to be of type ObservableCollection<object> and can be bound. Therefore the binding expression could be retrieved as well.

            <ig:XamMultiColumnComboEditor x:Name="ComboEditorProducts"
                                          Height="30"
                                          Width="300"
                                          ItemsSource="{Binding Path=Products}"
                                          SelectedItems="{Binding Path=SelectedProducts, Mode=TwoWay}"
                                          AutoGenerateColumns="False"
                                          DisplayMemberPath="ProductName"
                                          AllowMultipleSelection="True"
                                          SelectionChanged="ComboEditorProducts_SelectionChanged">
                <ig:XamMultiColumnComboEditor.Columns>
                    <ig:TextComboColumn Key="ProductName" />
                    <ig:TextComboColumn Key="ProductID" />
                    <ig:TextComboColumn Key="UnitsInStock" />
                </ig:XamMultiColumnComboEditor.Columns>
            </ig:XamMultiColumnComboEditor>

    Class MainWindow
        Private Sub ComboEditorProducts_SelectionChanged(sender As Object, e As Infragistics.Controls.Editors.SelectionChangedEventArgs)
            'Dim selItems = ComboEditorProducts.SelectedItems
            Dim be As BindingExpression = BindingOperations.GetBindingExpression(ComboEditorProducts, Infragistics.Controls.Editors.XamMultiColumnComboEditor.SelectedItemsProperty)
            If be IsNot Nothing Then
                ' Now you have the BindingExpression for SelectedItems
                ' You can use it to interact with the binding
            End If
        End Sub
    End Class

    I am attaching a small sample app for reference as well. If you require any further assistance on the matter, please, let me know.

    Best regards,
    Bozhidara Pachilova
    Associate Software Developer

    3755.XMCCE_VB_Selection.zip

Children