Grid.IsSharedSizeScope 연결된 속성

정의

여러 Grid 요소가 크기 정보를 공유할지 여부를 나타내는 값을 가져오거나 설정합니다.Gets or sets a value that indicates that multiple Grid elements are sharing size information.

see GetIsSharedSizeScope, and SetIsSharedSizeScope
see GetIsSharedSizeScope, and SetIsSharedSizeScope
see GetIsSharedSizeScope, and SetIsSharedSizeScope

예제

다음 코드 예제에서는 IsSharedSizeScope Extensible Application Markup Language (XAML) 및 코드에서 속성을 사용 하는 방법을 보여 줍니다.The following code examples demonstrate how to use the IsSharedSizeScope property in Extensible Application Markup Language (XAML) and code.

<DockPanel Name="dp1" Grid.IsSharedSizeScope="False" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="10">

......

   <StackPanel Orientation="Horizontal" DockPanel.Dock="Top">  
       <Button Click="setTrue" Margin="0,0,10,10">Set IsSharedSizeScope="True"</Button>
       <Button Click="setFalse" Margin="0,0,10,10">Set IsSharedSizeScope="False"</Button>
   </StackPanel> 

   <StackPanel Orientation="Horizontal" DockPanel.Dock="Top">

   <Grid ShowGridLines="True" Margin="0,0,10,0">
     <Grid.ColumnDefinitions>
       <ColumnDefinition SharedSizeGroup="FirstColumn"/>
       <ColumnDefinition SharedSizeGroup="SecondColumn"/>
     </Grid.ColumnDefinitions>
     <Grid.RowDefinitions>
       <RowDefinition Height="Auto" SharedSizeGroup="FirstRow"/>
     </Grid.RowDefinitions>

       <Rectangle Fill="Silver" Grid.Column="0" Grid.Row="0" Width="200" Height="100"/>
       <Rectangle Fill="Blue" Grid.Column="1" Grid.Row="0" Width="150" Height="100"/>

       <TextBlock Grid.Column="0" Grid.Row="0" FontWeight="Bold">First Column</TextBlock>
       <TextBlock Grid.Column="1" Grid.Row="0" FontWeight="Bold">Second Column</TextBlock>
   </Grid>

   <Grid ShowGridLines="True">
     <Grid.ColumnDefinitions>
       <ColumnDefinition SharedSizeGroup="FirstColumn"/>
       <ColumnDefinition SharedSizeGroup="SecondColumn"/>
     </Grid.ColumnDefinitions>
     <Grid.RowDefinitions>        
       <RowDefinition Height="Auto" SharedSizeGroup="FirstRow"/>
     </Grid.RowDefinitions>

       <Rectangle Fill="Silver" Grid.Column="0" Grid.Row="0"/>
       <Rectangle Fill="Blue" Grid.Column="1" Grid.Row="0"/>

       <TextBlock Grid.Column="0" Grid.Row="0" FontWeight="Bold">First Column</TextBlock>
       <TextBlock Grid.Column="1" Grid.Row="0" FontWeight="Bold">Second Column</TextBlock>
   </Grid>
   
   </StackPanel>

   <TextBlock Margin="10" DockPanel.Dock="Top" Name="txt1"/>

......

Extensible Application Markup Language (XAML)에 정의 된 이벤트는 코드를 사용 하 여 처리 됩니다.Events defined in Extensible Application Markup Language (XAML) are handled using code.

private void setTrue(object sender, System.Windows.RoutedEventArgs e)
{
    Grid.SetIsSharedSizeScope(dp1, true);
    txt1.Text = "IsSharedSizeScope Property is set to " + Grid.GetIsSharedSizeScope(dp1).ToString();
}

private void setFalse(object sender, System.Windows.RoutedEventArgs e)
{
    Grid.SetIsSharedSizeScope(dp1, false);
    txt1.Text = "IsSharedSizeScope Property is set to " + Grid.GetIsSharedSizeScope(dp1).ToString();
}
Private Sub setTrue(ByVal sender As Object, ByVal args As RoutedEventArgs)

    Grid.SetIsSharedSizeScope(dp1, True)
    txt1.Text = "IsSharedSizeScope Property is set to " + Grid.GetIsSharedSizeScope(dp1).ToString()
End Sub

Private Sub setFalse(ByVal sender As Object, ByVal args As RoutedEventArgs)

    Grid.SetIsSharedSizeScope(dp1, False)
    txt1.Text = "IsSharedSizeScope Property is set to " + Grid.GetIsSharedSizeScope(dp1).ToString()
End Sub

설명

열 및 행 크기 공유에 참여 하는 고려 하지 않는 Star 크기 조정 합니다.Columns and rows participating in size sharing do not respect Star sizing. 이 시나리오에서는 Star 크기 조정으로 간주 됩니다 Auto합니다.In this scenario, Star sizing is treated as Auto.

눈금 크기 공유 하는 경우 작동 하지 않습니다 IsSharedSizeScope 로 설정 된 true 리소스 템플릿 내 및 SharedSizeGroup 해당 템플릿 외부에서 정의 됩니다.Grid size sharing does not work if IsSharedSizeScope is set to true within a resource template, and a SharedSizeGroup is defined outside of that template.

종속성 속성 정보Dependency Property Information

식별자 필드Identifier field IsSharedSizeScopeProperty
메타 데이터 속성 설정 trueMetadata properties set to true 없음None

적용 대상