Pages

Tuesday, 12 March 2013

UniformGrid Control in WPF

UniformGrid Control in WPF Window Based

The UniformGrid Control arranges content in its area so that all the cells in the grid have the same dimension. It represents a perfect solution if someone prefers to prevent the headache of ordering or arrange controls within an ordinary Grid.

First, the Uniform grid belongs to the System.Windows.Controls. Primitives. It could be found in the tool box at the bottom. A UniformGrid show child elements or control in columns and rows of the same size. Or we can say The number of cells is adjusted to accommodate the number of controls. 


Example:

XAML Code:

<Window x:Class="WpfApplication7.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Window1" Height="370" Width="417" Loaded="Window_Loaded">
    <Grid>
         <UniformGrid Margin="15,15,15,15" Name="uniformGrid1">
                <Image Source="2.jpeg"  Name="img1" ></Image>
                <Image Source="2.jpeg"  Name="img2" ></Image>
             <Image Source="2.jpeg"  Name="img3" ></Image>
            <Line></Line>
             <Line></Line>
             <Line></Line>
                <Image Source="2.jpeg"  Name="img4" ></Image>
                <Image Source="2.jpeg"  Name="img5" ></Image>
                <Image Source="2.jpeg"  Name="img6" ></Image>
        </UniformGrid>
        </Grid>
</Window> 
 
Output-

No comments:

Post a Comment