Skip to content

Commit e6cc21c

Browse files
committed
multi action popup disables better in eager mode
1 parent 1280c1a commit e6cc21c

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

MaterialDesignThemes.Wpf/PopupBox.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -305,9 +305,10 @@ protected override void OnIsKeyboardFocusWithinChanged(DependencyPropertyChanged
305305

306306
protected override void OnMouseEnter(MouseEventArgs e)
307307
{
308-
if (PopupMode == PopupBoxPopupMode.MouseOverEager
309-
|| PopupMode == PopupBoxPopupMode.MouseOver)
310-
308+
if (IsEnabled &&
309+
(PopupMode == PopupBoxPopupMode.MouseOverEager
310+
|| PopupMode == PopupBoxPopupMode.MouseOver))
311+
311312
SetCurrentValue(IsPopupOpenProperty, true);
312313

313314
base.OnMouseEnter(e);

MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.PopupBox.xaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.ToolTip.xaml" />
1010
</ResourceDictionary.MergedDictionaries>
1111

12+
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
1213
<converters:NullableToVisibilityConverter x:Key="NullVisibilityConverter" />
1314
<converters:NullableToVisibilityConverter x:Key="InvertedNullVisibilityConverter" NullValue="Visible" NotNullValue="Collapsed" />
1415

@@ -251,15 +252,16 @@
251252
CustomPopupPlacementCallback="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=PopupPlacementMethod}"
252253
PlacementTarget="{Binding ElementName=PART_Toggle}"
253254
Placement="Custom"
254-
PopupAnimation="None"
255+
PopupAnimation="None"
255256
AllowsTransparency="True">
256257
<Grid>
257258
<!-- with PopupBox.PopupMode == MouseOverEager the popup is always open, with
258259
content hidden. but Transparent doesnt seem to register hit test in the popup.
259260
this opacity is the lowest I could get to register hit test. might try and speak
260261
to MS about this one, I *think* it is a bug -->
261-
<Border Background="White" Opacity="0.002" />
262+
<Border Background="White" Opacity="0.002" />
262263
<ContentControl Content="{TemplateBinding PopupContent}" ContentTemplate="{TemplateBinding PopupContentTemplate}"
264+
Visibility="{TemplateBinding IsEnabled, Converter={StaticResource BooleanToVisibilityConverter}}"
263265
Margin="5" Padding="8"
264266
Opacity="0" x:Name="PART_PopupContentControl">
265267
<ContentControl.Resources>

0 commit comments

Comments
 (0)