0
모든 행에 그룹 상자가있는 3 개의 행이있는 눈금이있는 페이지를 사용하고 있습니다. 그룹 상자에는 내용이 다른 여러 가지 격자가 포함되어 있습니다. 동일한 너비에 맞게 모든 그룹 상자를 갖고 싶습니다. 처음에는 그런 경우입니다. 그러나 첫 번째 그룹 상자의 내용이 코드 배후에서 업데이트되면 그룹 상자는 매우 짧은 순간 (폭은 더 작음) 다시 그려 지지만 두 번째 나중에 다시 너비에 맞습니다. 처음에는 "연결되지 않음"이 "연결됨"으로 바뀌므로 너비가 더 작습니다. 내 윈도우의 너비가 최대화되도록 설정되어 있고 페이지와 격자의 너비와 높이를 고치지 않으려 고합니다. 콘텐츠에 맞게 상자를 만들지 않고도 콘텐츠를 업데이트 할 수있는 방법이 있습니까?WPF : 내용에 맞게 그룹 상자를 다시 그리지 마십시오.
예 (2 행) : 당신이 내용을 변경할 수 있지만 원하는대로 결국 결과가 켜져있는
<Grid Grid.IsSharedSizeScope="True" Name="globalGrid" >
<Grid.ColumnDefinitions>
<ColumnDefinition SharedSizeGroup="globalCol"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition SharedSizeGroup="RowA"/>
<RowDefinition SharedSizeGroup="RowA"/>
<RowDefinition SharedSizeGroup="RowA"/>
</Grid.RowDefinitions>
<GroupBox Header="Connection status"
Grid.Row="0" Grid.Column="0"
HorizontalAlignment="Stretch">
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Rectangle Name="Connected"
Style="{StaticResource iconConnectStyle}"
DataContext="{Binding DeviceConnection}"
Grid.Row="0" Grid.Column="0" />
<TextBlock Text="device 1:"
Grid.Row="0" Grid.Column="1"
Style="{StaticResource statusText}"/>
<TextBlock Name="dev1" Grid.Row="0" Grid.Column="2"
Style="{StaticResource statusText}" />
</Grid>
</GroupBox>
<GroupBox Header="processing status"
Grid.Row="1" Grid.Column="0"
HorizontalAlignment="Stretch">
<StackPanel>
<TextBlock x:Name="processState" Style="{StaticResource statusText}"/>
<ProgressBar x:Name="progressState"/>
</StackPanel>
</GroupBox>
</Grid>
따라 다름 GroupBoxes가 너비를 변경하는 것처럼 보입니다. 적어도 그것이 당신의 질문을 이해하는 방법입니다. 그래서 질문은 그것이 작동 할 때 왜 이것에 대해 망설이 는가입니다. :) –
예, 작동하지만 완벽한 것은 아닙니다 ;-) – purbsel
타이타닉 완벽했습니다. 그리고 우리 모두는 그녀에게 무슨 일이 일어 났는지 압니다. 그 작은 세부 사항에 관하여 고민하지 말라. 그 행동에 대해 걱정하지 마십시오. 그게 wpf에서 실제로 정상입니다. –