I have added grouping to a checkcombobox. It gets populated and the drop-down displays the items correctly, but I am having trouble getting the selected items to display - after selections are made, only the object reference is displayed in the box, e.g., "CWCB.DataLayer.water_district | CWCB.DataLayer.water_district". The xaml is presented below along with the code-behind which sets the item source to a ListCollectionView. Any hints on what I need to add to the xaml so that the selected items are displayed?
thanks
<xctk:CheckComboBox Margin="5" x:Name="cbDivWaterDist" Width="250" Height="30" HorizontalAlignment="Left" VerticalAlignment="Top"
//during loading event of user control
ListCollectionView lcv = new ListCollectionView(lstDivWD); //lstDivWD is a List<water_district>() populated in the constructor of the user control
lcv.GroupDescriptions.Add(new PropertyGroupDescription("Division"));
cbDivWaterDist.ItemsSource = lcv;
public partial class water_district
{
thanks
<xctk:CheckComboBox Margin="5" x:Name="cbDivWaterDist" Width="250" Height="30" HorizontalAlignment="Left" VerticalAlignment="Top"
ItemsSource="{Binding}" Delimiter=" | " ItemSelectionChanged="cbDivWaterDist_ItemSelectionChanged"
>
<xctk:CheckComboBox.Resources>
<Style x:Key="GroupItem" TargetType="{x:Type GroupItem}">
<Setter Property="Margin" Value="0,0,0,5"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type GroupItem}">
<Expander IsExpanded="False">
<Expander.Header>
<StackPanel Orientation="Horizontal">
<CheckBox x:Name="ckhSelectAllDivision" Checked="ckhSelectAllDivision_Checked" Unchecked="ckhSelectAllDivision_Unchecked"/>
<TextBlock Text="{Binding Path=Name, StringFormat=Division: {0}}"></TextBlock>
</StackPanel>
</Expander.Header>
<Expander.Content>
<Border Margin="5,0,0,0">
<ItemsPresenter />
</Border>
</Expander.Content>
</Expander>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</xctk:CheckComboBox.Resources>
<xctk:CheckComboBox.GroupStyle>
<GroupStyle ContainerStyle="{StaticResource GroupItem}"></GroupStyle>
</xctk:CheckComboBox.GroupStyle>
<xctk:CheckComboBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding WD}"/>
</DataTemplate>
</xctk:CheckComboBox.ItemTemplate> </xctk:CheckComboBox>//during loading event of user control
ListCollectionView lcv = new ListCollectionView(lstDivWD); //lstDivWD is a List<water_district>() populated in the constructor of the user control
lcv.GroupDescriptions.Add(new PropertyGroupDescription("Division"));
cbDivWaterDist.ItemsSource = lcv;
public partial class water_district
{
public string Division { get; set; }
public string WaterDistrict { get; set; }
public string DistrictName { get; set; }
public string WD
{
get
{
return WaterDistrict + " - " + DistrictName;
}
}
}