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
20
how to render xamComboEditor items horizontally
posted

Hi,

is there any way to display xamComboEditor items horizontally rather than vertically ? If it needs to be done by setting some property then Can any one tell me that property ?

Regards,

Mudit Singh

Parents
No Data
Reply
  • 6365
    Offline posted

    Hello Mudit,

    In order to change the orientation of the items within the WPF XamComboEditor's dropdown, I can suggest you handle its DropDownOpened event and by manually getting the respective VirtualizingStackPanelEx element that holds the elements, you will be able to set its Orientation property to Horizontal.

    Code-behind:

    private void combo_DropDownOpened(object sender, RoutedEventArgs e)
    {
        this.Dispatcher.BeginInvoke(new Action(() =>
        {
            var dropdownPopup = GetOpenPopups().FirstOrDefault().Child;
            if (dropdownPopup == null)
                return;

            var panel = Utilities.GetDescendantFromType(dropdownPopup, typeof(VirtualizingStackPanelEx), false) as VirtualizingStackPanelEx;
            if (panel == null)
                return;
            panel.Orientation = Orientation.Horizontal;
        }));
    }

    I have attached a sample application that demonstrates the approach from above.

    If you have any questions, please let me know.

    XamComboEditor_sample.zip
Children
No Data