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.
Related
I have a question related to how does the FormBorderStyle property works. When I set the property to Sizable, the Windows taskbar shows perfectly, but when I set it to other than that (e.g. FixedSingle, FixedDialog, etc.), the taskbar doesn't show, it is hidden behind the WinForms application. How can I set the FormBorderStyle to other than Sizable and still be able to see the taskbar?
EDIT: What I mean by the taskbar is the Windows taskbar, on which the applications are shown. This is an example with the FormBorderStyle set to Sizable:
image. As you can see, when you move the mouse to the bottom of the screen, the Windows taskbar shows.
In contrast, when I set the property to, for example, FixedSingle, this is what happens: image. The taskbar doesn't show.
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 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
I am opening a form in a mdi parent. I show the form in the parent and the window state of the new form in the designer is maximized. For some reason, the form appears in the top left corner of the mdi parent, and the control box is way over to the right as if it was maximized, but the size of the window is not filling up the screen. So the behavior is as if it were maximized, but it is not filling the screen. What should I do?
I'm using C#.Net Winform.
Set your child form's window state to maximized.
This will maximize your form.
childForm.WindowState = FormWindowState.Maximized;
You can do this on load of your MdiParent form, or whenever you open show this child form.
Make sure your MdiChilds MaximumSize Property is not set. If it is it will look like this, which looks like what you have described in your question.
Coming in late, but I too am having this problem and so far nobody's answered why it's happening. I found this discussion on MSDN that explains more of what is really a workaround suggested by #nunespascal:
Basically I can't set WindowState to Maximised in the Designer, but if I leave it set to Normal and then when loading the form in code I set it to Maximised it works.
This is also the answer provided in this StackOverflow post.
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