Handle screen changes using WPF

Pardhu2020
Posted by in WPF category on for Beginner level | Points: 250 | Views : 2226 red flag

In this article, we will discuss how to handle screen changes using WPF

Introduction

Hi friends today we will discuss how to handle screen changes using WPF


  1. Once open the Visual Studio click on File Click on the Project.

  1. As you are seeing there are many application(s) from them Select WPF application
  2. At name rename it as per your requirement

Adding new Window



  1. Right click on the project and click on add from there click on window for adding a new window to the project
  2. Rename the window as per your requirement

  1. Drag a text box from tools .
  2. Drag a TextBlock from the tools and rename it as Window Title her will will get the window title
  3. Drag and drop two text boxes .Arrange it below Window Title
  4. Drag and drop TextBlock and place before those text boxes and name it as window dimensions.
<Window x:Class="DataBindingExamples.Window1"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="Window1" Height="300" Width="300">
    <StackPanel Margin="15">
        <WrapPanel>
            <TextBlock Text="Window Title:  "/>
            <TextBox Text="{Binding Title, UpdateSourceTrigger=PropertyChanged}" Width="150"/>
        </WrapPanel>
        <WrapPanel Margin="0,10,0,0">
            <TextBlock Text="Window dimensions: " />
            <TextBox Text="{Binding Width}" Width="50" />
            <TextBlock Text=" x " />
            <TextBox Text="{Binding Height}" Width="50" />
        </WrapPanel>
    </StackPanel>
</Window>


Out Put :
Based on the window changes text box will file the exact value of the dimensions



Conclusion

In this article we have seen how to handle screen changes using WPF .



Page copy protected against web site content infringement by Copyscape

About the Author

Pardhu2020
Full Name: Pardha Saradhi
Member Level:
Member Status: Member
Member Since: 3/19/2013 2:21:22 PM
Country: India

http://www.dotnetfunda.com

Login to vote for this post.

Comments or Responses

Login to post response

Comment using Facebook(Author doesn't get notification)