W
Wonko the Sane
Hello All,
There seems to be an issue (as demonstrated by the code below), where each
of the following is true:
1. A WPF Window is set up with AllowsTransparency="True",
WindowStyle="None", and the Topmost is bound to a menu item.
2. A menu and toolbar are the children of a StackPanel
3. The toolbar contains a toggle button, which also bounds to the same menu
item as the window's Topmost property.
When the toggle button is unchecked, the menu will be underneath the
toolbar, making it impossible to select.
Just something I stumbled on, and didn't know if anybody else might have the
same problem.
Thanks,
WtS
<Window x:Class="MenuAndToolbarBug.Window1" Name="windowMain"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
WindowStyle="None" AllowsTransparency="True"
Title="Menu and Toolbar Bug Example" Topmost="{Binding
ElementName=mnuOption1, Path=IsChecked}"
SizeToContent="WidthAndHeight">
<StackPanel >
<Menu>
<MenuItem Name="mnuOptions" Header="_Options">
<MenuItem Name="mnuOption1" IsCheckable="True"
Header="_Option 1" IsChecked="True" />
<MenuItem IsCheckable="True" Header="_Option 2"
IsChecked="True" />
</MenuItem>
</Menu>
<ToolBar>
<ToggleButton Name="btnStayOnTop" MaxHeight="26"
IsChecked="{Binding
ElementName=mnuOption1, Path=IsChecked}" Content="Toggle">
<ToggleButton.Style>
<Style TargetType="{x:Type ToggleButton}">
<Style.Triggers>
<Trigger Property="IsChecked" Value="True">
<Setter Property="Background"
Value="DarkGray" />
</Trigger>
</Style.Triggers>
</Style>
</ToggleButton.Style>
</ToggleButton>
<Button Name="btnClose" Content="Close" Margin="10,5,5,5"/>
</ToolBar>
</StackPanel>
</Window>
There seems to be an issue (as demonstrated by the code below), where each
of the following is true:
1. A WPF Window is set up with AllowsTransparency="True",
WindowStyle="None", and the Topmost is bound to a menu item.
2. A menu and toolbar are the children of a StackPanel
3. The toolbar contains a toggle button, which also bounds to the same menu
item as the window's Topmost property.
When the toggle button is unchecked, the menu will be underneath the
toolbar, making it impossible to select.
Just something I stumbled on, and didn't know if anybody else might have the
same problem.
Thanks,
WtS
<Window x:Class="MenuAndToolbarBug.Window1" Name="windowMain"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
WindowStyle="None" AllowsTransparency="True"
Title="Menu and Toolbar Bug Example" Topmost="{Binding
ElementName=mnuOption1, Path=IsChecked}"
SizeToContent="WidthAndHeight">
<StackPanel >
<Menu>
<MenuItem Name="mnuOptions" Header="_Options">
<MenuItem Name="mnuOption1" IsCheckable="True"
Header="_Option 1" IsChecked="True" />
<MenuItem IsCheckable="True" Header="_Option 2"
IsChecked="True" />
</MenuItem>
</Menu>
<ToolBar>
<ToggleButton Name="btnStayOnTop" MaxHeight="26"
IsChecked="{Binding
ElementName=mnuOption1, Path=IsChecked}" Content="Toggle">
<ToggleButton.Style>
<Style TargetType="{x:Type ToggleButton}">
<Style.Triggers>
<Trigger Property="IsChecked" Value="True">
<Setter Property="Background"
Value="DarkGray" />
</Trigger>
</Style.Triggers>
</Style>
</ToggleButton.Style>
</ToggleButton>
<Button Name="btnClose" Content="Close" Margin="10,5,5,5"/>
</ToolBar>
</StackPanel>
</Window>