我有2个不同的窗口,我想将滚动仅保留在其中一个窗口中。我发布了可以找到滚动的xaml代码,用户选择和图像时触发的代码,以及一些说明性的屏幕截图。我希望我清楚自己。如果您需要更多详细信息,请随时询问
<k:KinectScrollViewer Grid.Row="0" Name="scrollViewer" HorizontalScrollBarVisibility="Visible" VerticalScrollBarVisibility="Disabled">
<WrapPanel VerticalAlignment="Center" x:Name="wrapPanel" Orientation="Vertical" k:KinectTileButton.Click="KinectTileButtonClick">
<Image Height="150" Name="image1" Stretch="Fill" Width="200" />
代码2:
protected void KinectTileButtonClick(object sender, RoutedEventArgs e)
{
var button = (KinectTileButton)e.Source;
if (button.Tag is WineGroupModel)
{
C1 C1 = new C1(); //mainwindow
C1.ImagesDir = (button.Tag as WineGroupModel).WinesDir;
C1.Show();
}
else if (button.Tag is WineModel)
{
var wineModel = button.Tag as WineModel;
var selectionDisplay = new SelectionDisplay(wineModel);
this.kinectRegionGrid.Children.Add(selectionDisplay);
e.Handled = true;
}
else
{
throw new NotImplementedException("Unkown Wine object type");
}
}
答案 0 :(得分:1)
根据您的评论,在CodeBehind中,您可以使用
显示/隐藏滚动条this.scrollViewer.HorizontalScrollBarVisibility = // Visible or Hidden