MaterialDesignInXamlToolkit
MaterialDesignInXamlToolkit copied to clipboard
PopupBox with Style MaterialDesignMultiFloatingActionAccentPopupBox on startup hides sub-elements but leaves them active
Just a quick report: I've tried this one also on the demo application and it's reproduced there as well.
It seems like that when a PopupBox is first created, its sub-elements are not rendered - however they are active (i.e. if we are talking about a stackpanel of buttons, those will be clickable even if not visible). This issues kind of solves itself as soon as the PopupBox is used for the first time.
I'll just flag the issue, but won't go too deep into it as not having time ATM, but I'll show a small workaround that can be made while the issue is solved.
If we take the code from the wpf demo project:
<materialDesign:PopupBox Style="{StaticResource MaterialDesignMultiFloatingActionAccentPopupBox}"
PlacementMode="BottomAndAlignCentres"
ToggleCheckedContentCommand="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=wpfExample:Buttons}, Path=FloatingActionDemoCommand}"
ToggleCheckedContentCommandParameter="wowsers"
Margin="0 0 48 0"
ToolTip="PopupBox, Style MaterialDesignMultiFloatingActionAccentPopupBox">
<materialDesign:PopupBox.ToggleCheckedContent>
<materialDesign:PackIcon Kind="Pencil" Width="24" Height="24" />
</materialDesign:PopupBox.ToggleCheckedContent>
<StackPanel>
<Button ToolTip="One">1</Button>
<Button ToolTip="Two" IsEnabled="False">2</Button>
<Button ToolTip="Three">3</Button>
</StackPanel>
</materialDesign:PopupBox>
If we ran the code above we will have the following happening: the button One is active and clickable even though not visible (now the mouse arrow is missing from the screen-shot, but the tooltip is still visible),

As I said I didn't have a good look to the source code, so I can't really tell where the fix should be, however a quick workaround is possible: given a user-defined BoolToVisibibility converter, this can be applied to the PopupBox container in order to hide it when the property IsPopupOpen is false:
<!-- add the name to the popupBox -->
<materialDesign:PopupBox Name="MyPopupBox" Style="{StaticResource MaterialDesignMultiFloatingActionAccentPopupBox}"
PlacementMode="BottomAndAlignCentres"
ToggleCheckedContentCommand="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=wpfExample:Buttons}, Path=FloatingActionDemoCommand}"
ToggleCheckedContentCommandParameter="wowsers"
Margin="0 0 48 0"
ToolTip="PopupBox, Style MaterialDesignMultiFloatingActionAccentPopupBox">
<materialDesign:PopupBox.ToggleCheckedContent>
<materialDesign:PackIcon Kind="Pencil" Width="24" Height="24" />
</materialDesign:PopupBox.ToggleCheckedContent>
<!-- add the visibility binding -->
<StackPanel Visibility="{Binding Path=IsPopupOpen, ElementName=MyPopupBox, Converter={StaticResource BoolToVisibilityConverter}}">
<Button ToolTip="One">1</Button>
<Button ToolTip="Two" IsEnabled="False">2</Button>
<Button ToolTip="Three">3</Button>
</StackPanel>
</materialDesign:PopupBox>
Hope this helps -
Interesting workaround. I encountered the same problem here #504
Oh didn't see the #504 - otherwise I would have posted there. Sorry
There are any progress this bug? scual's workaround doesn't work for me, but the problem is disappeared when I change the PopupMode to Click. (But this way changed the behaviour of the popupbox).
Reported as fixed by JCL on Discord: