How to implement grid panel in wpf appication?

Leave a Comment
In Wpf application Grid Panel is much more important for design of wpf application. Here i am giving you idea about the grid panel with complete source code. You can download source code also from here.

MainWindow
<Window x:Class="gridpanel.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="*"/>
            <RowDefinition Height="2*"/>
            <RowDefinition Height="3*"/>          
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*"/>
            <ColumnDefinition Width="2*"/>      
        </Grid.ColumnDefinitions>
        <Rectangle Grid.Row="0" Grid.Column="0" Fill="AliceBlue"></Rectangle>
        <Rectangle Grid.Row="0" Grid.Column="1" Fill="Black"></Rectangle>
     
        <Rectangle Grid.Row="1" Fill="Red" Grid.Column="0"></Rectangle>
        <Rectangle Grid.Row="1" Fill="Yellow" Grid.Column="1"></Rectangle>
     
        <Rectangle Grid.Row="2" Fill="Pink" Grid.Column="0"></Rectangle>
        <Rectangle Grid.Row="2" Fill="Orange" Grid.Column="1"></Rectangle></Grid>
</Window>

Just run this simple code and you will get complete idea of Grid Panel. Here you can see output which will complete things about grid panel.

Output:

Here you can check all different colors with their diff height. 





0 comments:

Post a Comment