Click here to Skip to main content
15,897,891 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Is there any way of keeping an eye on the state of windows taskbar?

I want to create a form which remains maximised (and fixed to its location) irrespective of the windows taskbar state changes.

May be an event or something?
Posted
Comments
[no name] 15-May-14 9:11am    
Sounds like you are looking for "kiosk" mode.
kartikguha 15-May-14 10:25am    
I read about kiosk mode after your reply. It is not actually what I am looking for.

I dont want to keep my window on top, I just want to make sure the screen size is same as maximum working area available, and I do want the task bar to be visible.

But thanks for the info :)

Hi Kartik,

Just use:

1. WindowStyle="None" - for showing the window without minimize/maximize & close button
2. WindowStartupLocation - for setting the location
3. ShowInTaskbar = "False" - for preventing the window task bar visibility.

XML
<Window x:Class="WpfApplication13.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525" ShowInTaskbar="False" WindowStyle="None" WindowStartupLocation="Manual" Left="200" Top="40">
    <Grid>
        
    </Grid>
</Window>
 
Share this answer
 
v2
Comments
kartikguha 15-May-14 13:51pm    
I dont want my window to hide from taskbar,and the first two things i have allready done.

What i want is to change my screen size and component placement sa soon as taskbar's size/location is changed.

Is there any way to accomplish it?

Thanks for your support :)
Shai Vashdi 15-May-14 14:14pm    
I've showed you how to change the window location above. Just register to the Window State changed event, and then change the size and location
kartikguha 20-May-14 10:00am    
That's what i wanted to know, if there is any such event for windows taskbar (as user wont be able to resize the window).

Thanks :)
Shai Vashdi 20-May-14 12:32pm    
You most welcome, please mark the question as answered.
I got the solution by myself :)

Instead of changing the ResizeMode (to CanMinimize) and WindowStyle (to None) from the window properties, i changed it in load event

VB
Me.ResizeMode = Windows.ResizeMode.CanMinimize
Me.WindowStyle = Windows.WindowStyle.None


also i had to averload the show method (as i wanted to use show and hide methods to minimize it to tray)

VB
Overloads Sub show()

    Me.ResizeMode = Windows.ResizeMode.CanResize
    Me.WindowStyle = Windows.WindowStyle.SingleBorderWindow

    MyBase.Show()

    Me.ResizeMode = Windows.ResizeMode.CanMinimize
    Me.WindowStyle = Windows.WindowStyle.None

End Sub


this allowed the windows taskbar to remain visible as WindowStyle was changed after a window was assigned to my form.

This allowed me to have an invisible parent window that uses WPF's default resizing properties.

When I was changing ResizeMode and WindowStyle from windows property pane in visual studio, as window style was none before even loading, no parent was assigned to my form and thus my application went "kiosk".

I hope my explanation would help others facing similiar issues :)

And to all who took time to reply, and helped me, a big thanks guys :)
 
Share this answer
 
v2

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