Quantcast
Channel: Our ComponentOne » All Posts
Viewing all articles
Browse latest Browse all 14170

C1ListBoxItem IsSelected

$
0
0

Is there a reason why the Setter of the property IsSelected from C1ListBoxItem is declared internal?

I would to bind the C1ListBox to a list of elements, where every element has a IsSelected property and bind this to the C1ListBoxItem IsSelected put I fail to do so because of the internal declaration.

This Xaml works find when I use the standard Listbox:

<ListBox Name="list" ItemsSource="{Binding OpData}" BorderThickness="1" BorderBrush="Black" Margin="10,10,10,10" SelectionChanged="SelectionChanged">
        <ListBox.ItemContainerStyle>
            <Style TargetType="{x:Type ListBoxItem}">
                <Setter Property="IsSelected"  Value="{Binding Mode=TwoWay, Path=OpIsSelected}" />
            </Style>
        </ListBox.ItemContainerStyle>
        <ListBox.ItemTemplate >
            <DataTemplate>
                <TextBlock VerticalAlignment="Center" Text="{Binding OpText, Mode=OneWay}" />
            </DataTemplate>
        </ListBox.ItemTemplate>
    </ListBox>

But when I change it to c1:C1ListBox it fails, because of the IsSelected giving the Message="Writeable property expected!".

<c1:C1ListBox Name="list" ItemsSource="{Binding OpData}" BorderThickness="1" BorderBrush="Black" Margin="10,10,10,10" SelectionChanged="SelectionChanged">
        <c1:C1ListBox.ItemContainerStyle>
            <Style TargetType="{x:Type c1:C1ListBoxItem}">
                <Setter Property="IsSelected"  Value="{Binding Mode=TwoWay, Path=OpIsSelected}" />
            </Style>
        </c1:C1ListBox.ItemContainerStyle>
        <c1:C1ListBox.ItemTemplate >
            <DataTemplate>
                <TextBlock VerticalAlignment="Center" Text="{Binding OpText, Mode=OneWay}" />
            </DataTemplate>
        </c1:C1ListBox.ItemTemplate>
    </c1:C1ListBox>

Viewing all articles
Browse latest Browse all 14170

Trending Articles



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