【发布时间】:2019-10-16 15:56:41
【问题描述】:
在使用 Caliburn Micro MVVM 时,我无法使 WPF 中的 ScrollViewer 工作! https://github.com/moon1234moon/Factures
这是我的 XML 代码:
<ScrollViewer VerticalScrollBarVisibility="Visible"
HorizontalScrollBarVisibility="Visible">
<Grid HorizontalAlignment="Left" VerticalAlignment="Top"
MaxHeight="900"
MaxWidth="900"
>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="20" />
<ColumnDefinition Width="auto" />
<ColumnDefinition Width="auto" />
<ColumnDefinition Width="auto" />
<ColumnDefinition Width="auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="20" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="20" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="*" />
<RowDefinition Height="20" />
</Grid.RowDefinitions>
<!-- Deleted because they are quite a lot -->
<ContentControl Grid.Column="3" Grid.Row="1" Grid.RowSpan="5"
x:Name="ActiveItem"
Margin="30, 150, 30, 30"
/>
</Grid>
</ScrollViewer>
当然,我尝试让滚动启用 IsEnabled = true 并添加了 VerticalAlignment 和 HorizentalAlignment,但这些似乎都不起作用!..
请帮忙!! PS:对我来说最重要的是能够水平滚动查看ContentControl的内容
【问题讨论】:
-
您不想在 Grid 中使用 Scrollviewer?
-
根据stackoverflow.com/questions/22756920/…这是正确的做法。
-
是用户控件还是窗口?
-
@Frenchy 它是用户控件
-
我跟着你我是@TravisN1213
标签: c# wpf mvvm caliburn.micro