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
190
XamComboEditor Selected value in Edit mode.
posted

Hello,

I'm having the XamComboEditor in XamDataGrid, I've applied following  template

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

<Setter Property="ItemTemplate">

<Setter.Value>

<DataTemplate>

<StackPanel Orientation="Horizontal">

<TextBlock Text="{Binding Path=ListValue}" />

<TextBlock Text="{Binding Path=ListDesc}" Margin="10,0,0,0"/>

</StackPanel>

</DataTemplate>

</Setter.Value>

</Setter>

</Style>

I’ve used the applied this template from code behind,

System.Windows.Style formatingStyle = new Style(typeof(XamComboEditor));

formatingStyle.Setters.Add(new Setter

                        {

                            Property = XamComboEditor.ComboBoxStyleProperty,

                            Value = (Style)this.FindResource("TCComboStyle")

                        });

 

When I selected the item from the Combo box, that time it showing both value and desc. I’m expecting to show only Value. When I tab out from the current cell, and edit mode for this cell ended, that time it shows properly that is it shows only value. After selecting the item from the combo-box it’s still in edit mode and that time it shows the value and Desc. But I need to show only value even in edit mode when combo-box is not expanded. Please suggest your ideas.

Thanks in adavance.

-Ashwath 

 

  • 190
    Verified Answer
    posted

    I’ve to set the TextProperty too.

    formatingStyle.Setters.Add(new Setter

                            {

                                Property = XamComboEditor.TextProperty,

                                Value = "ListValue"

                            });

    That’s it.

    -Ashwath