WPF Window attribute | Properties examples

November 11, 2015 0 Comments

In this article, we will learn many more attributes or you can say properties of window tag in WPF. First of, I will take Width and Height properties of Window Tag. Width defines Horizontal size of window and Height vertically. Both takes numbers. If you do some changes in these attribute then your window will resize. Now, come to Next attribute that is Title, Define the label of title bar, which is the Top most bar of your window. Title is aligned in center bydefault. 

Icon: If you want to put image in left corner which is realted to your project like suppose your project window is related to login, now you can put login image into your title bar in left corner.

ResizeMode : Change the window size at run time, if you want. Minimize and Maximize button appear by using this arrtibute. Also you can hide both buttons, if you assign "NoResize" value in it. By using this value, hide minimize and maximize button as well as resize arrow. 

ShowInTaskbar : The default value of it is 'True'. It means when your application will run  then your application icon will display into your taskbar. If you assign False then does not appear in Taskbar.

SizeToContent : Define the window size which is totaly depend on your content. If you assign 'width' as a value in it then your window's width resized. Similarly in case of Height.

TopMost : Your window will always appear at top position. The Default value of it is false.

Jacob Lefore

Some say he’s half man half fish, others say he’s more of a seventy/thirty split. Either way he’s a fishy bastard. Google