WPF listbox selection focus between observablecollection and collectionviewsource

30 Views Asked by At

I have two listboxes which are binding, one with an observablecollection and the other with a collectionviewsource.

with the listbox binding with the observablecollection I do not have the focus selection on the other hand with collectionviewsource yes.

I would like not to with the selection focus using the collectionviewsource but I can't find which property to act on.

For information I use the MahApp theme.

Sorry for my english.

first listbox with collectionviewsource (barrel longitudinale)

second listbox with observablecollection (barre transversale)

how to remove focus bounding box? (selectionitem "HA4")

enter image description here

mouse hover is good for both.

enter image description here

enter image description here

wpf code

<!--Barre Longitudinale-->
                <StackPanel
                    Grid.Row="0" Grid.Column="0">
                    <mah:MetroHeader
                        Header="Barres longitudinales"/>
                    <Separator/>
                </StackPanel>
                <ListBox 
                    Margin="5"
                    Grid.Row="1" Grid.Column="0"
                    ItemsSource="{Binding Source={StaticResource CatalogueBarre}}">
                    <ListBox.ItemContainerStyle>
                        <Style TargetType="{x:Type ListBoxItem}">
                            <Setter Property="Focusable" Value="False"/>
                        </Style>
                    </ListBox.ItemContainerStyle>
                    <ListBox.ItemTemplate>
                        <DataTemplate>
                            <CheckBox Content="{Binding ID}" IsChecked="{Binding IsLongitudinale}"/>
                        </DataTemplate>
                    </ListBox.ItemTemplate>
                </ListBox>

                <!--Barre Transversale-->
                <StackPanel
                    Grid.Row="0" Grid.Column="1">
                    <mah:MetroHeader
                        Header="Barres transversales"/>
                    <Separator/>
                </StackPanel>
                <ListBox Margin="5"
                         Grid.Row="1" Grid.Column="1"
                         ItemsSource="{Binding listBarre, Source={x:Static param:Catalogue.instance}}">
                    <ListBox.ItemContainerStyle>
                        <Style TargetType="{x:Type ListBoxItem}">
                            <Setter Property="Focusable" Value="False"/>
                        </Style>
                    </ListBox.ItemContainerStyle>
                    <ListBox.ItemTemplate>
                        <DataTemplate>
                            <CheckBox Content="{Binding ID}" IsChecked="{Binding IsTransversale}"/>
                        </DataTemplate>
                    </ListBox.ItemTemplate>
                </ListBox>
<!-- barre -->
            <CollectionViewSource x:Key="CatalogueBarre" Source="{Binding listBarre, Source={x:Static param:Catalogue.instance}}"/>

            <!-- barre longitudinale (filtre) -->
            <CollectionViewSource x:Key="CatalogueBarreLongitudinale" Source="{Binding listBarreLongitudinale, Source={x:Static param:Catalogue.instance}}"/>
         
            <!-- barre longitudinale (filtre) -->
            <CollectionViewSource x:Key="CatalogueBarreTransversale" Source="{Binding listBarreTransversale, Source={x:Static param:Catalogue.instance}}"/>

the only difference between the 2 lists is:

ItemsSource="{Binding Source={StaticResource CatalogueBarre}}
ItemsSource="{Binding listBarre, Source={x:Static param:Catalogue.instance}}
0

There are 0 best solutions below