Hi,
You can find the doc on the properties of the CheckListBox here : https://wpftoolkit.codeplex.com/wikipage?title=CheckListBox&referringTitle=Home
If you don't have the "IsSelected" property, you don't need to set the "SelectedMemberPath". "SelectedValue" is the string representing the selection. If you set the "SelectedItemsOverride", you don't need to set the "SelectedValue". "SelectedItemsOverride" is the Collection of items selected. If you have a "SelectedItems" property on your object, you can use it to set/get the selected items.
Here's what works for me :
You can find the doc on the properties of the CheckListBox here : https://wpftoolkit.codeplex.com/wikipage?title=CheckListBox&referringTitle=Home
If you don't have the "IsSelected" property, you don't need to set the "SelectedMemberPath". "SelectedValue" is the string representing the selection. If you set the "SelectedItemsOverride", you don't need to set the "SelectedValue". "SelectedItemsOverride" is the Collection of items selected. If you have a "SelectedItems" property on your object, you can use it to set/get the selected items.
Here's what works for me :
<xctk:CheckComboBox x:Name="lbMatlList"
Height="250"
Width="400"
DisplayMemberPath="TheText"
Delimiter="|"
SelectedItemsOverride="{Binding SelectedItems}">
</xctk:CheckComboBox>
public partial class MainWindow : Window
{
private static List<string> MatlList = new List<string>()
{
"first", "second", "third", "fourth"
};
public MainWindow()
{
InitializeComponent();
this.lbMatlList.Items.Clear();
int iMatls = 0;
for( int iNum = 1; iNum <= MatlList.Count; iNum++ )
{
string tString = MatlList[ iNum - 1 ];
// Check whether this entry should be checked
bool Used = true; //ContainsLabel( tString, SelMatlList );
this.lbMatlList.Items.Add( new Used_Material( Used, tString ) );
//Used_Material MatlItem = this.lbMatlList.Items( iMatls );
iMatls += 1;
}
this.lbMatlList.DataContext = this; //To be able to use MainWindow.SelectedItems property
this.SelectedItems = new ObservableCollection<Used_Material>() { this.lbMatlList.Items[ 1 ] as Used_Material };
}
public ObservableCollection<Used_Material> SelectedItems
{
get;
set;
}
}
public class Used_Material
{
public bool IsSelected
{
get;
set;
}
public string TheText
{
get;
set;
}
public Used_Material( bool tmpUsed, string tmpName )
{
IsSelected = tmpUsed;
TheText = tmpName;
}
}