views:

16

answers:

0

i try to write some codes : Header, Footer, Right, Left panel. But it must be like css Automatic width (if i maximize button in my explorer or firefox scanner). Such as default header width 300 if clicking max button of explorer it runs reat-x like css


<UserControl x:Class="DockPanel3.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    mc:Ignorable="d"
             xmlns:local="clr-namespace:DockPanel3">
  <Grid x:Name="LayoutRoot">
        <Grid.RowDefinitions>
            <RowDefinition Height="2*"></RowDefinition>
            <RowDefinition Height="6*"></RowDefinition>
            <RowDefinition Height="2*"></RowDefinition>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="2*"></ColumnDefinition>
            <ColumnDefinition Width="6*"></ColumnDefinition>
            <ColumnDefinition Width="2*"></ColumnDefinition>
        </Grid.ColumnDefinitions>
        <local:SilverlightControlheader HorizontalAlignment="Left" Grid.Row="0" Margin="2,2,2,2" Grid.Column="0" Grid.ColumnSpan="3"></local:SilverlightControlheader>
        <local:SilverlightControlfooter HorizontalAlignment="Left" Grid.Row="2" Margin="2,2,2,2" Grid.Column="0" Grid.ColumnSpan="3"></local:SilverlightControlfooter>
        <local:SilverlightControlleft HorizontalAlignment="Left" Grid.Row="1" Grid.Column="0" Margin="2,2,2,2"></local:SilverlightControlleft>
        <local:SilverlightControlright HorizontalAlignment="Left" Grid.Row="1" Grid.Column="2" Margin="2,2,2,2"></local:SilverlightControlright>
    </Grid>
</UserControl>

Header


<UserControl x:Class="DockPanel3.SilverlightControlheader"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
Height="100">
    <Grid x:Name="LayoutRoot" Background="AliceBlue">
        <Grid.RowDefinitions>
            <RowDefinition Height="100"></RowDefinition>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="auto"></ColumnDefinition>
        </Grid.ColumnDefinitions>
        <StackPanel Background="Green">
        <TextBlock Grid.Row="0"  Grid.Column="0" Foreground="Black" HorizontalAlignment="Stretch">This is header</TextBlock>
            </StackPanel>
    </Grid>
</UserControl>

Footer


<UserControl x:Class="DockPanel3.SilverlightControlfooter"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
     Height="100">
    <Grid x:Name="LayoutRoot" Background="White">
        <Grid.RowDefinitions>
            <RowDefinition Height="100"></RowDefinition>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="auto"></ColumnDefinition>
        </Grid.ColumnDefinitions>
        <StackPanel Background="Blue">
            <TextBlock Grid.Row="0" HorizontalAlignment="Stretch" Grid.Column="0" Foreground="Gray">This is footer</TextBlock>
        </StackPanel>
    </Grid>
</UserControl>

Left


<UserControl x:Class="DockPanel3.SilverlightControlleft"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    Width="100">
    <Grid x:Name="LayoutRoot" Background="White">
        <Grid.RowDefinitions>
            <RowDefinition Height="auto"></RowDefinition>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="100"></ColumnDefinition>
        </Grid.ColumnDefinitions>
        <StackPanel Background="Yellow">
        <TextBlock Grid.Row="0" HorizontalAlignment="Stretch" Grid.Column="0" Foreground="Blue">This is left</TextBlock>
            </StackPanel>
    </Grid>
</UserControl>

Right


<UserControl x:Class="DockPanel3.SilverlightControlright"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    Width="100">
    <Grid x:Name="LayoutRoot" Background="White">
        <Grid.RowDefinitions>
            <RowDefinition Height="auto"></RowDefinition>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="100"></ColumnDefinition>
        </Grid.ColumnDefinitions>
        <StackPanel Background="Red">
            <TextBlock Grid.Row="0" HorizontalAlignment="Stretch" Grid.Column="0" Foreground="CornflowerBlue">This is right</TextBlock>
        </StackPanel>

    </Grid>
</UserControl>