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
255
ComboBox with XamWebGrid
posted

Hey, I am in a merge of a windows project to silverlight, and I had a combobox usercontrol that displays a datagrid:

So, I have now a combobox with a SL datagrid like this:

and the code is:

public class MyComboBox : ComboBox
    {
        public MyComboBox()
        {
            DefaultStyleKey = typeof(MyComboBox);
        }
        Popup popup;
        DataGrid g;
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();
            popup = ((Grid) VisualTreeHelper.GetChild(this, 0)).FindName("Popup") as Popup;
            if (popup != null) g = ((Border)((Canvas)popup.Child).Children[1]).Child as DataGrid;
            g.SelectionChanged += g_SelectionChanged;
            g.MouseLeftButtonUp += g_MouseLeftButtonUp;
        }

        void g_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            IsDropDownOpen = false;
        }

        void g_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (e.AddedItems.Count == 0)
                SelectedIndex = 0;
            else
                SelectedItem = e.AddedItems[0];
        }     
    } 

-----

So, I want to know if there is any way to do this with a XamWebGrid instead of DataGrid because I need to use the filtering feature, and then if it's possible use a infragistics combobox editor instead of a generic combobox.

Thanks in advance,

Paul.

Parents Reply Children
No Data