Home Forums WPF controls Xceed Toolkit Plus for WPF WatermarkCombobox DisplayMemberPath problem

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • molnard
    Post count: 2
    #43617 |


    I have a DataGridControl and one of it Column set like this:

            <xcdg:DataGridControl ItemsSource="{Binding Source={StaticResource Mylist}}">
                    <xcdg:Column FieldName="MyProperty"
                                 CellContentTemplate="{StaticResource Celldatatemplate}" 
                                 CellEditor="{StaticResource categoryEditor}"/>

    I also defined some resources:

                <DataTemplate x:Key="Celldatatemplate" DataType="local:Class1">
                    <TextBlock Text="{Binding Path=Prop1}"></TextBlock>
                <!-- This is a very straightforward ComboBox editor used for the Category Column. -->
                <xcdg:CellEditor x:Key="categoryEditor">
                            <!-- We prefer a BorderThickness of 0 but some ComboBox templates may 
                           ignore this preference (in Classic Theme for instance). -->
                            <!-- Notice the MinHeight set to the same value as the Cell previously. -->
                            <!-- The important glue mechanism is CellEditorBinding that takes care 
                           of creating the Binding with the Cell's value. -->
                                ItemsSource="{Binding Path=MyComboboxList, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:MainWindow}}}"

    When I drop down my combobox the class name appears as the text of the combobox. Very similar like this problem:

    If I change to standard Combobox everything works fine. Why DisplayMemberPath not working like at standart combobox? How can I solve this?

    If I override ToString method at my class it is also working. But I would like to use CellContentTemplate that is why I defined it.

    Thank you for your help!

    Fawzi [Xceed]
    Post count: 722


    My suggestion would have been to override the ToString method. However, since you mentioned that this is happening only with the Toolkit ComboBox and not the default one, could you send me a simple stand alone sample project which reproduces the issue so that I could have a closr look. You may send it to: support@xceed.com

    Post count: 2

    Hi Fawzi,

    I sent you a simple project by email, the problem is on this picture


                <ColumnDefinition Width="*"></ColumnDefinition>
                <ColumnDefinition Width="*"></ColumnDefinition>
                <RowDefinition Height="30"></RowDefinition>
                <RowDefinition Height="30"></RowDefinition>
            <Label Content="WPF Combobox"></Label>
            <Label Grid.Row="0" Grid.Column="1" Content="WPF Combobox"></Label>
            <ComboBox Grid.Row="1" Grid.Column="0" ItemsSource="{Binding Class1S}" SelectedValuePath="Id" DisplayMemberPath="Text" SelectedValue="{Binding Path=Cathegory1, ValidatesOnExceptions=True }"></ComboBox>
            <xctk:WatermarkComboBox x:Name="ComboBox" Grid.Row="1" Grid.Column="1" SelectedValuePath="Id" ItemsSource="{Binding Class1S}" DisplayMemberPath="Text" SelectedValue="{Binding Path=Cathegory1, ValidatesOnExceptions=True }" />


            public List<Class1> Class1S
                get { return _class1S; }
                set { _class1S = value; }
            private int _cathegory1;
            private List<Class1> _class1S = new List<Class1>();
            public int Cathegory1
                    return _cathegory1;
                    _cathegory1 = value;
            public MainWindow()
                DataContext = this;


        public class Class1
            public string Text { get; set; }
            public int Id { get; set; }


Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.