Silverlight 验证摘要屏幕空间
银光3;
我的网格的顶行有一个 ValidationSummary。当 ValidationSummary 出现时,它将我的按钮行(第 3 行)推离可显示屏幕的底部。
<Grid HorizontalAlignment="Stretch"
VerticalAlignment="Stretch">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="36" />
</Grid.RowDefinitions>
<di:ValidationSummary Grid.Row="0" />
<Grid x:Name="gridOuterContentHolder"
Grid.Row="1">
<Grid.RowDefinitions>
<RowDefinition Height="0.68*" />
<RowDefinition Height="5" />
<RowDefinition Height="0.32*" />
</Grid.RowDefinitions>
<!-- elements removed for brevity -->
</Grid>
<StackPanel x:Name="stack"
Grid.Row="2"
Orientation="Horizontal"
HorizontalAlignment="Right">
<Button Content="Delete"
x:Name="btnDelete"
Height="20"
Width="75" />
</StackPanel>
</Grid>
我是一个代码猴子,而不是像素推动者,无法弄清楚我需要 Stretch、Auto 和 * 的哪种组合。那里有任何推手可以帮忙吗?
谢谢, 标记
Silverlight 3;
I have a ValidationSummary in the top row of my grid. When the ValidationSummary appears, it pushes my button row (row 3) off the bottom of the displayable screen.
<Grid HorizontalAlignment="Stretch"
VerticalAlignment="Stretch">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="36" />
</Grid.RowDefinitions>
<di:ValidationSummary Grid.Row="0" />
<Grid x:Name="gridOuterContentHolder"
Grid.Row="1">
<Grid.RowDefinitions>
<RowDefinition Height="0.68*" />
<RowDefinition Height="5" />
<RowDefinition Height="0.32*" />
</Grid.RowDefinitions>
<!-- elements removed for brevity -->
</Grid>
<StackPanel x:Name="stack"
Grid.Row="2"
Orientation="Horizontal"
HorizontalAlignment="Right">
<Button Content="Delete"
x:Name="btnDelete"
Height="20"
Width="75" />
</StackPanel>
</Grid>
I'm a code monkey not a pixel pusher and can't figure out which combination of Stretch's, Auto's and *'s I need. Any pushers out there that can help??
Thanks,
Mark
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我可以通过使validationsummary控件成为带有maxheight集的scrollview的子项来做到这一点。这限制了验证摘要超出其父级最大高度的能力。
因为默认情况下,validationsummary 控件使用 getparent() 来确定它们正在验证的控件,这要求您在应用程序初始化时手动覆盖目标(在 vb 中,我在页面类的 new() 例程中执行此操作。
您可能不想在没有错误的情况下看到滚动查看器,因此将其设置为折叠并使其仅在验证时可见摘要有错误:
我似乎无法让这个编辑器不搞砸xaml,这是一个关联:
示例
I was able to do this by making the validationsummary control a child of scrollview with a maxheight set. This limits the ability of the validationsummary to stretch beyond its parent's maxheight.
Because by default, validationsummary controls use a getparent() to determine the control they are validating, this requires you to manually override the target when the appication innitializes (in vb I do it in the new() routine of my page class.
You probably don't want to see the scrollviewer when there are no errors, so set it to Collapsed and in the make it visible only with the validationsummary has errors:
I can't seem to get this editor to not screw up the xaml, here's a link:
example