Quantcast
Channel: Caliburn.Micro: Xaml Made Easy
Viewing all articles
Browse latest Browse all 1760

New Post: ListBox.SelectedItems convention

$
0
0
Bladewise,

I am attempting to use your SynchronizeSelection code but I am having a few problems. I have got the SynchronizeSelection.cs, Extensions.cs and Conventions.cs in my code and I have added the Conventions.Apply() to my bootstrapper Configure method as per your sample.

I have the following in the XAML
<ListBox x:Name="IOSNames" Height="60" SelectionMode="Multiple"/>
    <ScrollViewer  ScrollViewer.VerticalScrollBarVisibility="Auto">
                <ItemsControl ItemsSource="{Binding Path=SelectedIOSNames}"/>
    </ScrollViewer>
and code in the VM
    private BindableCollection<string> selectedIOS;
    public BindableCollection<string> SelectedIOSNames
        {
            get { return selectedIOS; }
            set
            {
                selectedIOS = value;
                NotifyOfPropertyChange(() => SelectedIOSNames);
            }
        }
When I select one or more items, they appear in the scrollviewer itemscontrol correctly but a breakpoint on the SelectedIOSNames setter never gets hit. I tried using the EventTrigger method from your sample as well and the same happens.

I removed the SelectionMode and added a SelectedIOSName property instead to my code with similar setter/getter. A breakpoint on this property gets hits correctly when I select an item. I need the multiple selection to call the VM code so that I can dynamically fetch data for another ListBox which depends on the selected values.

Do you have any idea why the multiple selection does not work?

The logger shows:

SelectedItems convention applied to IOSNames.
Binding Convention Applied: Element IOSNames.

Regards
Alan

Viewing all articles
Browse latest Browse all 1760

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>