AllowTransparency/Topmost/Binding Issue in WPF (VS2008)

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>
 
L

Linda Liu[MSFT]

Hi WtS,

Could you tell me what the OS version of the machine is on which the WPF
application is run?

I create a WPF Application project and copy your sample code in the
project.

Then I run the test application on Windows XP and all works fine. When the
toggle button is unchecked, the menu is NOT underneath the ToolBar. It
stays in the position as before.

I look forward to your reply.

Sincerely,
Linda Liu
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 
W

Wonko the Sane

Hmmm...I'm running XP with the latest updates.

Now, the menu bar isn't below the toolbar, just the expanded menu itself.
That said, we have seen inconsistent behavior with our major WPF app among
some of our test machines with the same versions, so its not out of the
question that it works on one machine and not another.

Thanks,
WtS
 
L

Linda Liu[MSFT]

Hi WtS,

Thank you for your reply!

The XP I'm using has also updated with latest updates.
Now, the menu bar isn't below the toolbar, just the expanded menu itself.


The problem doesn't exist on my XP machine.

Would you please send me a screen shot that could demonstrate the problem?
To get my actual email address, remove 'online' from my displayed email
address.

Sincerely,
Linda Liu
Microsoft Online Community Support
 
V

Venkatesh Mookkan

Hi Linda,
Me too faceing the same problem but with different control.

I am having a Window with AllowTransparency = "True". I have a bunch of
controls in it. The application work fine for a while. Later on when the
combo box drops, the dropdown is on visible at the top. It is dropping behind
the Transparent Window. Even though the scenario looks odd, it is happening
within few times.

I set the AllowTransparency to False and tried it and it works fine, but my
UI looks bad.

Could you help me to fix this?

I am using .NET 3.5 and C# as my programming language.
I am working on Window XP with all latest updates installed.
And I am a newbie to WPF, previously worked on Web Technology...

If you want I can send you the screenshots.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top