Skip to content

Commit acd5005

Browse files
committed
Merge branch 'disabled-listbox' of https://github.com/mgnslndh/MaterialDesignInXamlToolkit into mgnslndh-disabled-listbox
2 parents c38fbf1 + efbd418 commit acd5005

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

MainDemo.Wpf/Lists.xaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,22 @@
1414
</ResourceDictionary>
1515
</UserControl.Resources>
1616
<Grid Margin="8">
17+
<Grid.RowDefinitions>
18+
<RowDefinition/>
19+
<RowDefinition Height="Auto"/>
20+
</Grid.RowDefinitions>
1721
<Grid.ColumnDefinitions>
1822
<ColumnDefinition Width="1*" />
1923
<ColumnDefinition Width="1*" />
2024
<ColumnDefinition Width="1*" />
2125
</Grid.ColumnDefinitions>
22-
<ListBox Grid.Column="0">
26+
<ListBox Grid.Column="0" IsEnabled="{Binding IsChecked, ElementName=EnableListBox}">
2327
<TextBlock>Plain</TextBlock>
2428
<TextBlock>Old</TextBlock>
2529
<TextBlock>ListBox</TextBlock>
2630
<TextBlock>Full of junk</TextBlock>
2731
</ListBox>
32+
<CheckBox Name="EnableListBox" Grid.Row="1" IsChecked="True">Enabled</CheckBox>
2833
<!-- piece together your own items control to create some nice stuff that will make everyone think you are cool. and rightly so, because you are cool. you might even be a hipster for all I know -->
2934
<ItemsControl Grid.Column="1" ItemsSource="{Binding Items1}"
3035
Grid.IsSharedSizeScope="True"

MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.ListBox.xaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,9 @@
133133
<Trigger Property="IsSelected" Value="True">
134134
<Setter TargetName="Ripple" Property="Opacity" Value=".92" />
135135
</Trigger>
136+
<Trigger Property="IsEnabled" Value="False">
137+
<Setter Property="Opacity" Value=".56" />
138+
</Trigger>
136139
</ControlTemplate.Triggers>
137140
</ControlTemplate>
138141
</Setter.Value>
@@ -275,6 +278,11 @@
275278
Padding="{TemplateBinding Padding}"/>
276279
</Grid>
277280
</Border>
281+
<ControlTemplate.Triggers>
282+
<Trigger Property="IsEnabled" Value="False">
283+
<Setter Property="Opacity" Value=".56" />
284+
</Trigger>
285+
</ControlTemplate.Triggers>
278286
</ControlTemplate>
279287
</Setter.Value>
280288
</Setter>

0 commit comments

Comments
 (0)