Quantcast
Channel: Extended WPF Toolkit™ Community Edition
Viewing all articles
Browse latest Browse all 4964

Commented Unassigned: CheckComboBox DisplayMemebrPath problem [20919]

$
0
0
When selecting an item, the combobox shows exactly the right string. But while the droppbox is open, the named displayed in the droppbox are all set to the name of the entity in ItemSource.
This is my xaml:
```
<xctk:CheckComboBox Grid.Row="2" Grid.Column="1" HorizontalAlignment="Stretch" Margin="5,2,5,2" VerticalAlignment="Stretch" ItemsSource="{Binding Genders}" SelectedItemsOverride="{Binding SelectedGenders}" DisplayMemberPath="Title"/>
```
Also when I use below ItemTemplate droppbox shows right string and combobox shows selected entity names!
```
<DataTemplate x:Key="DisplayTemplate" DataType="{x:Type model:CMN_KeyValue}">
<TextBlock Text="{Binding Title}"/>
</DataTemplate>

<xctk:CheckComboBox Grid.Row="2" Grid.Column="1" HorizontalAlignment="Stretch" Margin="5,2,5,2" VerticalAlignment="Stretch" ItemsSource="{Binding Genders}" SelectedItemsOverride="{Binding SelectedGenders}" ItemTemplate="{StaticResource DisplayTemplate}"/>
```
I use 2.1 version
Comments: ** Comment from web user: BoucherS **

Hi,

Using v2.1 of the Toolkit, I can set the DisplayMemberPath on the CheckComboBox and the ComboBox AND its dropBox displays correctly. Here's my complete sample :
```
<Grid>
<xctk:CheckComboBox x:Name="_checkComboBox"
HorizontalAlignment="Stretch"
Height="22"
VerticalAlignment="Stretch"
ItemsSource="{Binding Genders}"
SelectedItemsOverride="{Binding SelectedGenders}"
DisplayMemberPath="Title"/>
</Grid>

public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();

_checkComboBox.DataContext = this;

this.Genders = new ObservableCollection<Gender>()
{
new Gender() { Title = "Man" },
new Gender() { Title = "Woman" },
};

this.SelectedGenders = new ObservableCollection<Gender>();
}

public ObservableCollection<Gender> Genders
{
get;
set;
}

public ObservableCollection<Gender> SelectedGenders
{
get;
set;
}
}

public class Gender
{
public string Title
{
get;
set;
}
}
```


Viewing all articles
Browse latest Browse all 4964

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>