Skip to content

Commit de943df

Browse files
committed
IsEnabled styling for PopupBox
1 parent 331ec1b commit de943df

File tree

2 files changed

+31
-3
lines changed

2 files changed

+31
-3
lines changed

MainDemo.Wpf/Buttons.xaml

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,8 @@
8989
</materialDesign:PopupBox>
9090
</StackPanel>
9191
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Bottom">
92-
<materialDesign:PopupBox Margin="16,0,16,0" StaysOpen="True">
92+
<CheckBox Name="PopupEnabled">Enable Popup</CheckBox>
93+
<materialDesign:PopupBox Margin="16,0,16,0" StaysOpen="True" IsEnabled="{Binding IsChecked, ElementName=PopupEnabled}">
9394
<Grid Width="300" Margin="8,8,8,8">
9495
<Grid.Resources>
9596
<Style TargetType="CheckBox" BasedOn="{StaticResource MaterialDesignCheckBox}">
@@ -303,7 +304,29 @@
303304
</ListBoxItem>
304305
</ListBox>
305306

306-
<ListBox Grid.Column="1" Grid.Row="1" Style="{StaticResource MaterialDesignToolToggleListBox}"
307+
<ListBox Grid.Column="1" Grid.Row="1" Style="{StaticResource MaterialDesignFlatToggleListBox}" SelectedIndex="0">
308+
<ListBox.ToolTip>
309+
<StackPanel>
310+
<TextBlock Text="MaterialDesignFlatToggleListBox" />
311+
<TextBlock Text="Exclusive selection" />
312+
<TextBlock Text="ListBoxAssist.IsToggle allows more natural toggle behaviour" />
313+
</StackPanel>
314+
</ListBox.ToolTip>
315+
<ListBoxItem>
316+
<TextBlock Text="00:00"/>
317+
</ListBoxItem>
318+
<ListBoxItem>
319+
<TextBlock Text="06:00"/>
320+
</ListBoxItem>
321+
<ListBoxItem>
322+
<TextBlock Text="12:00"/>
323+
</ListBoxItem>
324+
<ListBoxItem>
325+
<TextBlock Text="18:00"/>
326+
</ListBoxItem>
327+
</ListBox>
328+
329+
<ListBox Grid.Column="1" Grid.Row="2" Style="{StaticResource MaterialDesignToolToggleListBox}"
307330
SelectionMode="Extended"
308331
Margin="0 8 0 0">
309332
<ListBox.ToolTip>

MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.PopupBox.xaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,11 +118,16 @@
118118
</wpf:Card>
119119
</controlzEx:PopupEx>
120120
</Grid>
121+
<ControlTemplate.Triggers>
122+
<Trigger Property="IsEnabled" Value="false">
123+
<Setter Property="Opacity" Value="0.23"/>
124+
</Trigger>
125+
</ControlTemplate.Triggers>
121126
</ControlTemplate>
122127
</Setter.Value>
123128
</Setter>
124129
</Style>
125-
130+
126131
<wpf:PackIcon x:Shared="False" x:Key="MaterialDesignMultiFloatingActionPopupBoxIcon"
127132
Kind="Plus" Width="24" Height="24" Foreground="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=wpf:PopupBox}, Path=Foreground}" />
128133

0 commit comments

Comments
 (0)