---
title: "WPF APPLICATION"  
description: "WPF APPLICATION"  
author: "Jaya J"  
published: 2015-03-24  
updated: 2015-03-25  
canonical: https://www.mindstick.com/forum/23049/wpf-application  
category: ".net"  
tags: ["c#"]  
reading_time: 2 minutes  

---

# WPF APPLICATION

I want to change my [TEXTBOX](https://www.mindstick.com/forum/12714/dynamic-textbox-in-gridview),LABEL,[BUTTON](https://www.mindstick.com/articles/63/how-to-add-button-in-datagridview-in-csharp-dot-net) SIZES dynamically based on screen resolutions. [i.e](https://answers.mindstick.com/qa/39877/what-state-was-the-first-to-enter-the-union-i-e-was-the-first-to-ratify-the-united-states-constitution), [screen resolution](https://answers.mindstick.com/qa/102458/explain-the-significance-of-a-laptop-s-screen-resolution) of [system](https://www.mindstick.com/articles/23411/the-most-effective-method-to-find-the-perfect-small-business-phone-system-for-your-business) may vary based on computer sizes.when i'm using my wpf [application](https://www.mindstick.com/articles/12824/calculator-application-in-android) on different [systems](https://www.mindstick.com/articles/85451/best-travel-systems-for-newborns-to-pick) the sizes of TEXTBOX,LABEL, etc also change based on screen resolution.\
Tell [me the code](https://www.mindstick.com/forum/156831/can-you-tell-me-the-code-to-write-a-c-sharp-program) for this problem.Please help me.

## Replies

### Reply by Anonymous User

Hi Jaya , i have created a sample form as per your problem

**MainWindow.xaml**

```
<Window x:Class="WpfApplication1.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" MinHeight="350">    <Grid>        <Grid Height="Auto" Margin="2" Width="Auto">                       <Grid.RowDefinitions>                <RowDefinition Height="50"/>                <RowDefinition Height="1*"/>                <RowDefinition Height="50"/>                <RowDefinition Height="1*"/>                <RowDefinition Height="1*"/>            </Grid.RowDefinitions>                       <TextBlock Text="First Name"
HorizontalAlignment="Stretch" VerticalAlignment="Center" Grid.Row="0"/>            <Border BorderBrush="DarkGray"
BorderThickness="1" Grid.Row="1" Margin="5" CornerRadius="5">                <TextBox  HorizontalAlignment="Stretch"
VerticalAlignment="Stretch" Width="Auto" Height="Auto"/>            </Border>                       <TextBlock Text="Last Name"
HorizontalAlignment="Stretch" VerticalAlignment="Center" Grid.Row="2"/>            <Border BorderBrush="DarkGray"
BorderThickness="1" Grid.Row="3"  Margin="5" CornerRadius="5">            <TextBox  HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"  Width="Auto" Height="Auto"/>            </Border >            <Button Grid.Row="4"  Content="Button"
HorizontalAlignment="Stretch" Width="Auto" Height="Auto" Margin="10" FontSize="30">                            </Button>        </Grid>     </Grid></Window>
```

**MainWindow.cs**

```
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;using System.Windows;using System.Windows.Controls;using System.Windows.Data;using System.Windows.Documents;using System.Windows.Input;using System.Windows.Media;using System.Windows.Media.Imaging;using System.Windows.Navigation;using System.Windows.Shapes; namespace WpfApplication1{    /// <summary>    /// Interaction logic for MainWindow.xaml    /// </summary>    public partial class MainWindow : Window    {        public MainWindow()        {            InitializeComponent();        }    }} 
```

Hope this will help u solve your problem!!

Regards

Mayank


---

Original Source: https://www.mindstick.com/forum/23049/wpf-application

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
