I am working with wpf c#, I set the visibility of the child window to hidden on closing. But when I minimized the parent window, or clicked on the parent window from taskbar, there comes a shadow like window of the hidden child window.How can I avoid this.
Try to use Visibility.Collapsed instead of Visibility.Hidden
Related
I have a main WPF window. (henceforth, parent window). In this parent window I have a button. When button is clicked I open a custom messagebox window (henceforth, child window) in a position within parent window. When opening child window I pass as an argument the parent window, and another argument to indicate the child window where I want to locate it. Then within child window, according these parameters passed as arguments, I do some calculations based on the Top and Left coordinates of the parent Window.
I have seen that when parent window is maximized, then its Top and Left coordinates are not being updated, they are the same, I mean they keep unchanged keeping last values before parent window is maximized. Why?
As a result of this, when doing some calculations using Parent.Top and Parent.Left from child window, it is making my logic failing.
How can I obtain correct Parent.Top, Parent.Left and others like Parent.Height and Parent.Width from child window logic?
I use Visual Studio 2008 and NET 3.5 SP1.
So, I've been experimenting with child windows in WPF, using SetParent, and trying to set up some transparency on the child window. It looks like I've got a bit of a catch-22.
If I set the child's WindowStyle = None, as it seems is required for transparency, I cannot move/resize the child correctly. If I don't set the WindowStyle, I can't get transparency.
Does anyone have any ideas on either how to move/resize the child window correctly, when it's WindowStyle = None, or to get transparency without WindowStyle = None?
The parent window and child window are in separate processes. I am running on Windows 7. I am happy to use WinApi calls, language is in C#.
I should note that the user should not be able to reposition or resize the child window directly. The child window gets resized when the parent window is resized, so that the size of the child is alwasy relative to the size of the parent window.And, because the parent and child window are in separate processes, I am using SetWindowPos to resize the child window.
The example
https://github.com/Hexum064/TransparentChild
When I set the main window's visibility to hidden, No icon is shown in taskbar, so I have no control over the window to show it again. I want for the application's icon to be visible even when I hide the window, and to show the window when I click it's button in the taskbar. (something like minimize behavior)
How can I achieve that using WPF and .Net 4.0 in C#?
Edit: I mean the icon in taskbar (usually in the left and middle of the horizontal taskbar) not the notifyicon in system tray.
So, based on "comments" section, what you are looking to do is minimize or hide a window but still show some windows or dialogues that the window opens. First if you want to keep your window in the task bar, you should minimize with:
this.WindowState = WindowState.Minimized
That can be called from anywhere within the form. As you mentioned, though, this will close hide any dialogues that have this window set as the parent. The key, then is to not use this window as the parent. Lets say your dialogues inherit from form. You want to use:
newWindow.Show();
I am guessing that you are calling "ShowDialog", which ties the window state to the parent window state. Try this out and hopefully it will help!
Edit
One more note: the same is actually true of MessageBoxes, but the way to control the parent form is with the first parameter of the MessageBox.Show() call. If you pass in a form as the first parameter, that will be the parent, otherwise the parent will not be set.
I have a parent form and some child forms. Each of the child form has an icon at the top and left of the form. I would like to discard those icons but when I click on the icon property, I can only browse another icon and not delete the existing one. For that reason I set the showIcon property in each child form to false and the icons are not visible any more on the forms. So far so good.
My problem is that when a child form is open and maximized, the icon is shown. I want to make it go away and unfortunately I didn't find a way to do this. Any suggestions?
Thanks!
EDIT: I added a screenshot of the form, the unwanted icon is shown above menu strip. I want it to go away. When child form is NOT maximized, the icon disappears.
I guess you need to create a custom form border.
Please check http://geekswithblogs.net/kobush/articles/CustomBorderForms3.aspx
If I have a XAML window that I show with ShowDialog, is there a way to make it (not) appear in the taskbar?
The problem is that I can set the window to be topmost but if that window opens another dialog and I set that also to be topmost, I can put the second behind the first by clicking in the taskbar. This tends to confuse users.
In your child window, set the ShowInTaskbar property to false.