我有这个Xaml页面: 一旦我添加了inkGrid0.Visibility = Visibility.Collapsed到我的代码中, inkGrid1 inkGrid0现在已折叠的inkGrid1的左侧位置。 如何使inkGrid1在它的地方,当inkGrid0被倒塌? ...
提示:本站收集StackOverFlow近2千万问答,支持中英文搜索,鼠标放在语句上弹窗显示对应的参考中文或英文, 本站还提供 中文繁体 英文版本 中英对照 版本,有任何建议请联系yoyou2525@163.com。
我有一个应用程序,可以在网格中显示成排的堆叠面板。 用户可以隐藏堆栈面板的行以“清理”网格,并且仅查看/编辑他们想要的内容,其想法是折叠分隔器之间的堆栈面板,并关闭两个之间的空间。
当我将堆栈面板设置为Visibility.Collapsed时,堆栈面板消失,但它们所占据的空间仍然存在。
我如何消除差距? (我添加了updatelayout,但是这似乎没有做任何事情)
之前的样子: 之前
之后的样子: 之后
我的XAML:
<ScrollViewer Name="scroll" PanningMode="Both" Grid.Column="0" Grid.Row="1">
<ScrollViewer.Resources>
<sys:Double x:Key="{x:Static SystemParameters.VerticalScrollBarWidthKey}">50</sys:Double>
<sys:Double x:Key="{x:Static SystemParameters.VerticalScrollBarButtonHeightKey}">50</sys:Double>
</ScrollViewer.Resources>
<Grid x:Name="RecipeEditorCtrl" VerticalAlignment="Top">
</Grid>
</ScrollViewer>
我的C#:
...
int rowIndex = Grid.GetRow(CNtmp);
rowIndex++;
tmpCN = (CollectionNode)RecipeEditorCtrl.Children[rowIndex];
while (tmpCN.dataType.Text != "SEPERATOR")
{
tmpCN.Visibility = Visibility.Collapsed;
rowIndex++;
tmpCN = (CollectionNode)RecipeEditorCtrl.Children[rowIndex];
}
RecipeEditorCtrl.UpdateLayout();
}
您可以使用RowsDefinitions
并将每个RowDefinition
Height
属性设置为Auto
然后将StackPanel
添加到这些行
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.