I'm using the Xceed checkable combobox. Now I want to display a default text depending on the selected checkboxes in the combobox but I don't know how to do that.
For example:
The content (red arrow) of the textbox should be:
- If nothing is selected: "Please select"
- If everything is selected: "All People"
- If one or more are selected: "Specific selection"
Like:
Example-Code:
XAML:
<Window x:Class="WpfApplication1.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
Title="MainWindow" Height="350" Width="525">
<Grid>
<xctk:CheckComboBox x:Name="_checkComboBox"
Height="22"
VerticalAlignment="Stretch"
ItemsSource="{Binding Names}"
SelectedItemsOverride="{Binding SelectedNames}"
DisplayMemberPath="Title"
Delimiter=", "
Width="100"/>
</Grid>
</Window>
CS:
using System.Windows;
namespace WpfApplication1
{
using System.Collections.ObjectModel;
public partial class MainWindow
{
public MainWindow()
{
InitializeComponent();
_checkComboBox.DataContext = this;
Names = new ObservableCollection<People>()
{
new People() { Title = "Mikel" },
new People() { Title = "Tom" },
new People() { Title = "Jennifer" },
new People() { Title = "Megan" },
};
SelectedNames = new ObservableCollection<People>();
}
public ObservableCollection<People> Names
{
get;
set;
}
public ObservableCollection<People> SelectedNames
{
get;
set;
}
}
public class People
{
public string Title
{
get;
set;
}
}
}