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
670
XamComboEditor : synchronize with the current item
posted

Hello,

I'm using a XamComboEditor binded to a collection, but when I move the current item of the associated view the selected item of the combo editor is not updated.

If I use a "standard" ComboBox this is working fine (with IsSynchronizedWithCurrentItem="true"). So how can I have the same behaviour with my XamComboEditor control ?

Thanks

  • 69686
    Verified Answer
    posted

    Hello,

    The XamComboEditor uses a ComboBox internally. It exposes a ComboBoxStyle property, which you can use to set the IsSynchronizedWithCurrentItem property.

               <igEditors:XamComboEditor.ComboBoxStyle>

                    <Style TargetType="{x:Type ComboBox}">

                        <Setter Property="IsSynchronizedWithCurrentItem" Value="True"/>

                    </Style>

                </igEditors:XamComboEditor.ComboBoxStyle>

    This will work if you are using the XamComboEditor to change the CurrentItem of the Collection view.

    Unfortunately, the XamComboEditor will not reflect any changes to the current item if you set it from somewhere else (another element bound to the view). For this, you can handle the CurrentItemChanged event of the collection view and set the SelectedItem property of the XamComboEditor to the CurrentItem of the view.

    xamComboEditor1.SelectedItem = view.CurrentItem;

    This way, the XamComboEditor will reflect changes to the current item in both scenarios.