Click here to Skip to main content
15,899,026 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,

In WPF application, I want to set dialog property to be always present in background(windowA), even though it is obscured by some other window in the foreground due to some help button click, Once the foreground window is closed (windowB) the background windowA should be visible, and hence, I had made following code changes to WPF XAML code


Xaml code for WindowA

XML
 Window x:Class="UI.Windows.WindowA"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

Title="windowA"  Height="410" Width="468" WindowStyle="SingleBorderWindow" ResizeMode="NoResize" Visibility="Visible" WindowStartupLocation="CenterScreen" IsTabStop="True" Background="#E8EDF0" KeyUp="Window_KeyUp">


...............





in WindowsA.Xaml.cs file

C#
...... 
 
publicVisibilityVisibility { get; set; } 
 
......


I get the below error on compilation, even though all namespaces are mentioned.

error MC3029: 'Visibility' member is not valid because it does not have a qualifying type name


Also, I had added the following attributes to XAML code in WindowA

(Windows_Status=Normal; Visibility=Visible, IsFocusable=True; IsdisplayedInTaskbar=false)

even though the above settings does not enable the windowA once, I close the windowB,
(Always WindowA is either hidden/Invisible) when WindowB is closed.

Details: Windows 7 O/S, VS 2010 IDE

Any help in resolving the above would be much appreciable,

Regards,

VishalK_90
Posted
Updated 19-Jul-13 4:54am
v2
Comments
[no name] 19-Jul-13 8:57am    
The Visibility is actually an enum.

1 solution

I'm not sure you need to go through so many things to get what you want. Just leave Window A alone... so it is a regular, visible WPF window. Then open Window B using ShowDialog. It will automatically pop-up over top of Window A and when the user closes it, focus will return to Window A.

You code is pretty disjointed but there are a few other things... don't set a property in code and in xaml. The visibility property, specifically, you are setting in both places. Pick one or the other and put all the property settings there.

Secondly, trying to declare, with an auto-backed property, an override for a built-in property, like you are trying to do with Visibility, won't fly. If you want to override the built-in functions, you have to override the built-in property AND the backing dependency property method because Visibility is a dependency property. (You will see that if you refer to the MSDN documentation for FrameworkElement.Visibility) DP's don't get accessed from the binding engine in the same way as regular class properties.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900