wpftoolkit
wpftoolkit copied to clipboard
CheckComboBox ItemSelectionChanged not firing
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:imaging="clr-namespace:Microsoft.VisualStudio.Imaging;assembly=Microsoft.VisualStudio.Imaging"
xmlns:theming="clr-namespace:Microsoft.VisualStudio.PlatformUI;assembly=Microsoft.VisualStudio.Imaging"
xmlns:util="clr-namespace:Microsoft.VisualStudio.PlatformUI;assembly=Microsoft.VisualStudio.Utilities"
xmlns:catalog="clr-namespace:Microsoft.VisualStudio.Imaging;assembly=Microsoft.VisualStudio.ImageCatalog"
xmlns:toolkit="clr-namespace:Community.VisualStudio.Toolkit;assembly=Community.VisualStudio.Toolkit" xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
toolkit:Themes.UseVsTheme="True"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300"
Name="JiraWorklogWindow" Unloaded="JiraWorklogWindow_Unloaded">
<Grid>
<StackPanel x:Name="StackPanel" Orientation="Vertical">
<DockPanel Height="46" LastChildFill="False">
<PasswordBox x:Name="PasswordBox" Margin="0,5,0,5" Padding="0" Height="25" Width="150" VerticalContentAlignment="Center"/>
<Button Content="Search" Width="Auto" Margin="20,10,0,10" Click="SearchButton_ClickAsync"/>
</DockPanel>
<xctk:CheckComboBox x:Name="ViewSelect"
HorizontalAlignment="Left"
VerticalAlignment="Center"
ItemsSource="{Binding ViewList}"
VerticalContentAlignment="Center"
SelectedMemberPath="IsSelected"
ItemSelectionChanged="ViewSelect_ItemSelectionChanged"
Padding="0,5,0,5"
Margin="0,0,0,0"/>
</StackPanel>
<ScrollViewer x:Name="IssuesListView" Margin="0,100,0,0" VerticalScrollBarVisibility="Visible">
<StackPanel x:Name="StackPanel2" Orientation="Vertical">
<ItemsControl ItemsSource="{Binding CurrentView}"/>
</StackPanel>
</ScrollViewer>
</Grid>
</UserControl>
ViewList is an ObservableCollection<string>
The ItemSelectionChanging event is firing but the ```ItemSelectionChanged''' does not.
I was having a similar problem with both CheckComboBox and CheckListBox.
I have a list of sets of data which includes a list of strings (or technically a ruby array of IDs, that I then get the strings), which I then pre-fill a form to indicate the elements of that list selected. I was using SelectedItemsOverride to do this.
With ItemSelectionChanged, when switching data sets, the selection change event seems to fire off twice, but not when changing the tickboxes themselves. With ItemSelectionChanging, while the event seemed to fire when ticking the boxes, the indication of what was selected wouldn't change until I switched back and forth between data sets.
It's possible the real culprit was SelectedItemsOverride. I created a string version of the current selection and used SelectedValue instead, and the form now appears to function as expected. You appear to be using SelectedMemberPath, but I wonder if the problem is related.
I found this issue too #1350, when searching for a solution to my problem, which appeared to describe the behaviour I was having.
EDIT: Gotta make sure the delimiter matches in the string representation for the combo box too, it seems it.
Hi lxman,
If I run your sample with the latest v4.1 version of the Toolkit, available on NuGet, it works : the ItemSelectionChanged event is fired on every click/unclick of the CheckComboBox items.
<Grid> <xctk:CheckComboBox x:Name="ViewSelect" HorizontalAlignment="Left" VerticalAlignment="Center" ItemsSource="{Binding ViewList}" VerticalContentAlignment="Center" SelectedMemberPath="IsSelected" ItemSelectionChanged="ViewSelect_ItemSelectionChanged" Padding="0,5,0,5" Margin="0,0,0,0" /> </Grid>
` public MainWindow()
{
InitializeComponent();
this.DataContext = this;
this.ViewList = new ObservableCollection
public ObservableCollection<string> ViewList
{
get;
set;
}
private void ViewSelect_ItemSelectionChanged( object sender, Xceed.Wpf.Toolkit.Primitives.ItemSelectionChangedEventArgs e )
{
System.Diagnostics.Debug.WriteLine("Changed");
}`