Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/wpf/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# Silverlight的SharedSizeGroup_C#_Wpf_Silverlight_Xaml - Fatal编程技术网

C# Silverlight的SharedSizeGroup

C# Silverlight的SharedSizeGroup,c#,wpf,silverlight,xaml,C#,Wpf,Silverlight,Xaml,在Wpf中,我们有SharedSizeGroup属性来共享网格之间的大小,比如列的大小。有人知道Silverlight中的类似功能支持吗?共享大小调整最好使用Silverlight中的元素属性绑定来实现。只需将所有共享大小的元素绑定到另一个元素的宽度/高度即可 参考以下内容: <UserControl x:Class="SLTestApp.MainPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/present

在Wpf中,我们有SharedSizeGroup属性来共享网格之间的大小,比如列的大小。有人知道Silverlight中的类似功能支持吗?

共享大小调整最好使用Silverlight中的元素属性绑定来实现。只需将所有共享大小的元素绑定到另一个元素的宽度/高度即可

参考以下内容:

<UserControl x:Class="SLTestApp.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"
       xmlns:ext="clr-namespace:System.Windows.Controls.Extensions;assembly=System.Windows.Controls.Extensions"
       mc:Ignorable="d" d:DesignWidth="640" d:DesignHeight="480">

    <Grid x:Name="LayoutRoot" Background="White" ext:SharedSize.IsSharedSizeScope="True">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <Grid x:Name="firstfirstGrid" Grid.Row="0">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"  ext:SharedSize.SharedSizeGroup="A"/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" ext:SharedSize.SharedSizeGroup="A"/>
            </Grid.ColumnDefinitions>
            <Border BorderBrush="Green" BorderThickness="2">
                <TextBlock x:Name="txtFirstFirst" >
                    <Run>aa</Run>
                    <LineBreak />
                    <Run>aa</Run>
                </TextBlock>
            </Border>
        </Grid>
        <Grid x:Name="firstsecondGrid" Grid.Row="1">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"  ext:SharedSize.SharedSizeGroup="A"/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" ext:SharedSize.SharedSizeGroup="A"/>
            </Grid.ColumnDefinitions>
            <Border BorderBrush="Blue" BorderThickness="2">
                <TextBlock Text="aaaaaaaaaaaaaaaa" />
            </Border>
        </Grid>

    </Grid>
</UserControl>

aa
aa
链接参考:

<UserControl x:Class="SLTestApp.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"
       xmlns:ext="clr-namespace:System.Windows.Controls.Extensions;assembly=System.Windows.Controls.Extensions"
       mc:Ignorable="d" d:DesignWidth="640" d:DesignHeight="480">

    <Grid x:Name="LayoutRoot" Background="White" ext:SharedSize.IsSharedSizeScope="True">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <Grid x:Name="firstfirstGrid" Grid.Row="0">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"  ext:SharedSize.SharedSizeGroup="A"/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" ext:SharedSize.SharedSizeGroup="A"/>
            </Grid.ColumnDefinitions>
            <Border BorderBrush="Green" BorderThickness="2">
                <TextBlock x:Name="txtFirstFirst" >
                    <Run>aa</Run>
                    <LineBreak />
                    <Run>aa</Run>
                </TextBlock>
            </Border>
        </Grid>
        <Grid x:Name="firstsecondGrid" Grid.Row="1">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"  ext:SharedSize.SharedSizeGroup="A"/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" ext:SharedSize.SharedSizeGroup="A"/>
            </Grid.ColumnDefinitions>
            <Border BorderBrush="Blue" BorderThickness="2">
                <TextBlock Text="aaaaaaaaaaaaaaaa" />
            </Border>
        </Grid>

    </Grid>
</UserControl>

希望对您有所帮助。


<UserControl x:Class="SLTestApp.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" 
       xmlns:ext="clr-namespace:System.Windows.Controls.Extensions;assembly=System.Windows.Controls.Extensions"
       mc:Ignorable="d" d:DesignWidth="640" d:DesignHeight="480">

    <Grid x:Name="LayoutRoot" Background="White" ext:SharedSize.IsSharedSizeScope="True">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <Grid x:Name="firstfirstGrid" Grid.Row="0">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"  ext:SharedSize.SharedSizeGroup="A"/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" ext:SharedSize.SharedSizeGroup="A"/>
            </Grid.ColumnDefinitions>
            <Border BorderBrush="Green" BorderThickness="2">
                <TextBlock x:Name="txtFirstFirst" >
                    <Run>aa</Run>
                    <LineBreak />
                    <Run>aa</Run>
                </TextBlock>
            </Border>
        </Grid>
        <Grid x:Name="firstsecondGrid" Grid.Row="1">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"  ext:SharedSize.SharedSizeGroup="A"/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" ext:SharedSize.SharedSizeGroup="A"/>
            </Grid.ColumnDefinitions>
            <Border BorderBrush="Blue" BorderThickness="2">
                <TextBlock Text="aaaaaaaaaaaaaaaa" />
            </Border>
        </Grid>

    </Grid>
</UserControl>
aa aa