File tree Expand file tree Collapse file tree 3 files changed +25
-2
lines changed
MaterialDesignThemes.UITests/WPF/ListBoxes
MaterialDesignThemes.Wpf/Themes Expand file tree Collapse file tree 3 files changed +25
-2
lines changed Original file line number Diff line number Diff line change 69
69
UniqueKey =" list_4"
70
70
Grid.Column=" 1" >
71
71
<Grid >
72
- <ListBox >
72
+ <ListBox materialDesign:ListBoxItemAssist.ShowSelection=" False" >
73
+ <!--
74
+ Alternatively you can specify ListBoxItemAssist.ShowSelection on individual items
73
75
<ListBox.ItemContainerStyle>
74
76
<Style TargetType="ListBoxItem" BasedOn="{StaticResource MaterialDesignListBoxItem}">
75
77
<Setter Property="materialDesign:ListBoxItemAssist.ShowSelection" Value="False"/>
76
78
</Style>
77
79
</ListBox.ItemContainerStyle>
80
+ -->
78
81
<TextBlock Text =" Listbox" />
79
82
<TextBlock Text =" Without" />
80
83
<TextBlock Text =" Selection" />
Original file line number Diff line number Diff line change @@ -130,5 +130,25 @@ public async Task ScrollBarAssist_ButtonsVisibility_HidesButtonsOnMinimalistStyl
130
130
131
131
recorder . Success ( ) ;
132
132
}
133
+
134
+ [ Fact ]
135
+ public async Task OnListBoxAssist_WithShowSelectDisabled_SelectionIsDisabled ( )
136
+ {
137
+ await using var recorder = new TestRecorder ( App ) ;
138
+ var listBox = await LoadXaml < ListBox > ( $@ "
139
+ <ListBox materialDesign:ListBoxItemAssist.ShowSelection=""False"">
140
+ <ListBoxItem>Mercury</ListBoxItem>
141
+ <ListBoxItem>Venus</ListBoxItem>
142
+ <ListBoxItem>Earth</ListBoxItem>
143
+ <ListBoxItem>Pluto</ListBoxItem>
144
+ </ListBox>
145
+ " ) ;
146
+ var earth = await listBox . GetElement < ListBoxItem > ( "/ListBoxItem[2]" ) ;
147
+ await earth . LeftClick ( ) ;
148
+ var selectedBorder = await earth . GetElement < Border > ( "SelectedBorder" ) ;
149
+ await Wait . For ( async ( ) => Assert . False ( await selectedBorder . GetIsVisible ( ) ) ) ;
150
+
151
+ recorder . Success ( ) ;
152
+ }
133
153
}
134
154
}
Original file line number Diff line number Diff line change 223
223
<Setter Property =" VerticalContentAlignment" Value =" {Binding VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}" />
224
224
<Setter Property =" Padding" Value =" 8" />
225
225
<Setter Property =" SnapsToDevicePixels" Value =" True" />
226
- <Setter Property =" wpf:ListBoxItemAssist.ShowSelection" Value =" True " />
226
+ <Setter Property =" wpf:ListBoxItemAssist.ShowSelection" Value =" {Binding Path=(wpf:ListBoxItemAssist.ShowSelection), RelativeSource={RelativeSource AncestorType=ListBox}} " />
227
227
<Setter Property =" Template" >
228
228
<Setter .Value>
229
229
<ControlTemplate TargetType =" {x:Type ListBoxItem}" >
You can’t perform that action at this time.
0 commit comments