좀 이상한 문제가 있습니다.WrapPanel의 VerticalAlignment - 올바르게 작동시키는 방법?
여기 상황이 있습니다. 사용자 정의 데이터가 WrapPanel
가 (이 포함하는 하나 ToggleButton을 + 한 사용자 지정 컨트롤) StackPanel
의 사용자 지정 컨트롤은 기본적으로 표시되지 않으며 StackPanels
이 포함 된이있는, Expander
의에 표시 할 GroupStyle
정의와 I는 ListView
이 ToggleButton
이 선택되면 표시됩니다. 그러나 ToggleButton
을 확인하면 사용자 지정 컨트롤이 나타나고 같은 줄에있는 다른 모든 컨트롤이 세로 가운데로 이동합니다. 이상적으로, 나는이 다른 회원들이 맨 위에 머무르게하고 싶습니다. 내가 할 수있는 모든 곳에서 VerticalAlignment="Top"
을 설정하려했으나 어쨌든 변경되지 않습니다.
군데 문제 : 확장기의 초기 상태
다음ToggleButton
일단
는 여기를 클릭이 발생하는 것입니다 :
당신이 할 수 "테스트 분석"버튼을 가운데로 유지하기 위해 이동합니다. 원본과 같은 위치에 머물러 있기를 바랍니다.
또한이 스타일들은 각각 DataTemplate
개체에 정의되었습니다.
확장기의 content 속성 :
<Expander.Content>
<WrapPanel Background="White" VerticalAlignment="Top">
<ItemsPresenter VerticalAlignment="Top"/>
</WrapPanel>
</Expander.Content>
목록의 ItemsPanel
여기 일부 빛 코드 (난 그냥 :) 당신이 XAML 코드의 톤을 읽을하지 않습니다, 여기에 문제에 대한 쓸모없는 무엇 제거) :
<ItemsPanelTemplate >
<WrapPanel
Width="{Binding (FrameworkElement.ActualWidth),
RelativeSource={RelativeSource
AncestorType=Expander}}"
ItemWidth="{Binding (ListView.View).ItemWidth,
RelativeSource={RelativeSource AncestorType=ListView}}"
ItemHeight="{Binding (ListView.View).ItemHeight,
RelativeSource={RelativeSource AncestorType=ListView}}" />
</ItemsPanelTemplate>
ItemsTemplate
목록의 :
<StackPanel Orientation="Vertical" Height="Auto" Width="Auto" VerticalAlignment="Top" >
<ToggleButton BorderBrush="{x:Null}" Background="{x:Null}" IsChecked="{Binding Value.IsToLaunch, Mode=TwoWay}"
Command="{Binding DataContext.UpdateGroupCheckingsCommand,
RelativeSource={RelativeSource FindAncestor,
AncestorType={x:Type UserControl}}}">
<Grid Background="Transparent">
<!-- Blah blah blah about the ToggleButton's content -->
</Grid>
</ToggleButton>
<my:UcReleaseChooser>
<!-- Blah blah blah about being visible if ToggleButton is Checked -->
</my:UcReleaseChooser>
</StackPanel>
엄지 손가락을 늘이기 위해 최고 또는 목록보기의 VerticalContentAlignment 속성에 verticalalignment 속성을 설정하십시오! 꿈처럼 작동합니다. 나는 변화 시키려고 시도하지 않은 유일한 재산이었습니다. 다시 한 번 감사드립니다! – Damascus