This project is read-only.

ListBoxItem IsSelected TwoWay Binding

Jun 19, 2013 at 10:21 AM
Edited Jun 19, 2013 at 10:21 AM
 <ListBox ItemsSource="{Binding Path=FilterBaseFields}" SelectionMode="Multiple">
                <ListBox.ItemTemplate >
                    <DataTemplate  >
                        <TextBox Text="{Binding Path=Key, Mode=TwoWay}" extensions:ListBoxItemExtensions.IsSelected="{Binding Path=IsSelected, Mode=TwoWay}"/>
For Text TwoWay Binding works great, but for extensions:ListBoxItemExtensions.IsSelected - doesn't work (work only from source to view).
Have any Idea?
Jun 19, 2013 at 9:16 PM
That's right. It seems to be a limitation of this property. We would need to create a different one to support two way binding. Something like an "IsSelectedBinding" property using the pattern I described here:
Maybe when I get a chance I will add that to the toolkit.
Jun 20, 2013 at 7:55 AM
Thanks for response. For Binding IsSelected property of ListBoxItem I use that SO answer.
Jun 20, 2013 at 6:10 PM
Cool, that looks like a good solution if you can use a derived control.