하위 메뉴처럼 동작하는 Stackpannel 및 Grid 내에 Scrollviewer가 있습니다. 그것의 높이는 부모 메뉴에 묶여있다.XAML Scrollviewer 높이가 무한합니다
상위 메뉴 속성 :
<Grid Grid.Row="1" x:Name="tooldropdown" Width="250" VerticalAlignment="Stretch" Visibility="{Binding ElementName=ButtonToolbox, Path=IsChecked, Converter={StaticResource BoolToVisConverter}, FallbackValue=Hidden}">
하위 메뉴 :
<Grid x:Name="PopupBaseMapLayers" Grid.Row="1" Height="{Binding ElementName=tooldropdown, Path=Height}" Visibility="Collapsed" Panel.ZIndex="3000" >
<Border Background="White" Width="253" >
<StackPanel>
<Grid Height="30" Background="#FFC6DFFF" >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="31*" />
<ColumnDefinition Width="47*"/>
<ColumnDefinition Width="35" />
</Grid.ColumnDefinitions>
<Label Grid.Column="0"HorizontalContentAlignment="Center" Content="Base Maps" VerticalContentAlignment="Center" Height="30" BorderBrush="#c6dfff" BorderThickness="1" FontSize="14" Foreground="#FF004FB4" Grid.ColumnSpan="2">
<Label.Background>
<SolidColorBrush Color="#FFC6DFFF"/>
</Label.Background>
</Label>
<Button Grid.Column="2" Click="ButtonBaseMapLayers_Click" Background="#FF004FB4" FontWeight="Bold" FontFamily="OCR A Extended" Foreground="White" Margin="4,3,3,2" BorderBrush="{x:Null}">X</Button>
</Grid>
<ScrollViewer VerticalScrollBarVisibility="Visible" Margin="0,0,0,200" CanContentScroll="True" Height="{Binding ElementName=tooldropdown, Path=ActualHeight}" >
<ItemsControl HorizontalAlignment="Center" ItemsSource="{Binding BaseMapLayers, ElementName=EsriControl}">
<ItemsControl.ItemTemplate>
<DataTemplate DataType="{x:Type local:BaseMapLayer}">
<Border Background="Transparent" BorderBrush="Transparent" Margin="2" Padding="5">
<StackPanel Orientation="Horizontal">
<CheckBox VerticalAlignment="Center" IsEnabled="{Binding AddButtonEnabled}" IsChecked="{Binding IsInMenu}" Tag="{Binding}" />
<ContentPresenter ContentTemplate="{StaticResource BaseMapLayerMenuTemplate}" Width="250" />
</StackPanel>
</Border>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
</StackPanel>
</Border>
</Grid>
그러나 나는 데 문제는 그리드의 높이가 올 동안 ScrollViewer에 수직 오버 플로우 제대로 둥지를하지 않는다는 것입니다 그리드 내에서. 그것은 오버 플로우하지만 스크롤 막대가 사라하지 시각적으로는
그리드의 나머지 부분을 방해하는 것 같습니다. 코드를 편집하고 전체 내용을 추가했습니다. – Whirlwind991
내 편집을 참조하십시오. –
불행히도 작동하지 않는 것 같았지만이를 정렬 할 수있었습니다. 기묘한 문제지만 그것을 해결하기 위해 관리, 나는 해결책으로 내 솔루션을 게시했습니다. 그래도 도와 줘서 고마워! – Whirlwind991