StackPanel
을 (기본적으로 일종의 WinRT 허브 제어)으로 사용하는 ItemsControl
을 포함하는 WPF UserControl이 있습니다. 내 ItemsControl
주위에 ScrollViewer
을 추가하려고하면 그리고 내용이 ScrollViewer
이 ItemsControl
그래서 모든 항목이 해당 UserControl 경계에 맞게 축소, UserControl을ScrollViewer는 스크롤바를 표시하는 대신 내용의 크기를 변경합니다.
의 크기를 확장합니다.
어떻게 든 정확히 내가 scrollviewer가 이런 식으로 행동하는 이유를 누구에게 말해 줄 수 있을지 예상 할 수있는 반대?
여기에 내 UserControl
이다
<UserControl x:Class="ContentModule.ContentView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d"
xmlns:contentModule="clr-namespace:ContentModule"
xmlns:regions="http://www.codeplex.com/CompositeWPF"
xmlns:statics="clr-namespace:Infrastructure.Statics;assembly=Infrastructure"
d:DesignHeight="300" d:DesignWidth="300" d:DataContext="{d:DesignInstance contentModule:ContentViewModel}"
VerticalAlignment="Top" HorizontalAlignment="Left">
<ItemsControl regions:RegionManager.RegionName="{x:Static statics:ContentRegions.ContentCollection}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal" />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
</ItemsControl>
</UserControl>
항목이 프리즘 RegionManager 통해 주입된다.
EDIT1 :
UserControl
ContrentControl
=> ShellRegions.Content (세 번째)
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<ContentControl Grid.Row="0" cal:RegionManager.RegionName="{x:Static statics:ShellRegions.MainMenu}" />
<ItemsControl Grid.Row="1" cal:RegionManager.RegionName="{x:Static statics:ShellRegions.NavigationBar}" />
<ContentControl Grid.Row="2" cal:RegionManager.RegionName="{x:Static statics:ShellRegions.Content}" />
</Grid>
편집 2에 할당됩니다. 콘텐츠 저울 예상하지만 ItemsControl
이 ScrollBar
를 표시하지 않는 한 Form
/UserControl
의 경계를 변경 (오렌지가 ItemsControl
의 항목이며, 회색은 UserControl
입니다) :
ItemsControl
는 것 같습니다. ScrollViewer
을 추가하면 내용의 경계가 더 이상 변경되지 않고 세로 대신 가로 스크롤이 가능하거나 ScrollBar
속성에 따라 UserControll
에 맞게 항목 너비가 변경됩니다.
그러나 나는 스케일링을 유지하고 스크롤 막대를 ItemsControl
하단에 추가 할 수 없습니다.
안녕하세요, 목록 상자를 사용 –
사용자 컨트롤의 배치를 윈도우에 표시 할 수 있습니까? –
@devhedgehog 변경을 시도했지만 항목을 선택할 수 없으므로 ListBox에 다른 작업이 필요합니다. 사실 ItemsControl에 머물고 싶습니다. – Console