Here we are going to create simple basic form in wpf application. After creating this demo form you will get complete idea about design and how to design wpf forms also. Let's see this,
Main Window
Main Window
<Window x:Class="BasicFormDesign.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">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="2*" />
</Grid.ColumnDefinitions>
<TextBlock Text="Enter Name:" Grid.Row="0" Grid.Column="0" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="5,5"/>
<TextBox Name="UserName" Grid.Row="0" Grid.Column="1" Width="200" Margin="5" HorizontalAlignment="Left"/>
<TextBlock Text="Sex:" Grid.Row="1" Grid.Column="0" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="5,5"/>
<RadioButton GroupName="sextype" Grid.Row="1" Grid.Column="1" Content="Male" IsChecked="True" HorizontalAlignment="Left" Margin="5"/>
<RadioButton GroupName="sextype" Grid.Row="1" Grid.Column="1" Content="FeMale" Margin="60,5,5,5"/>
<TextBlock Text="Occupation:" Grid.Row="2" Grid.Column="0" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="5,5"/>
<CheckBox Grid.Row="2" Grid.Column="1" Content="Engineer" HorizontalAlignment="Left" Margin="5"/>
<CheckBox Grid.Row="2" Grid.Column="1" Content="Doctor" Margin="80,5,5,5"/>
<CheckBox Grid.Row="2" Grid.Column="1" Content="Professior" Margin="140,5,5,5"/>
<TextBlock Text="Category" Grid.Row="3" Grid.Column="0" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="5,5"/>
<ComboBox Grid.Row="3" Grid.Column="1" Margin="5">
<ComboBoxItem Content="Basic"/>
<ComboBoxItem Content="Professional"/>
</ComboBox>
<Button Grid.Row="4" HorizontalAlignment="Left" VerticalAlignment="Center" Grid.Column="1" Margin="5" Content="Save Details"></Button>
</Grid>
</Window>
Here you will get complete idea abou the controls like radio button , check boxes and combo boxes with grid panel is also there.
0 comments:
Post a Comment