WPF 分隔符未显示在工具栏 OverflowPanel 中
当您缩小工具栏的大小时,WPF 分隔符似乎不会显示在工具栏的溢出面板中;有什么办法让它显示出来吗? (我可以通过使用空的彩色标签来解决这个问题,但我仍然想知道为什么分隔符不起作用)。
示例:在 mainwindow.xaml 中创建一个新的 WPF 项目:
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<ToolBar HorizontalAlignment="Left" Name="toolBar1">
<Button Content="ASDF" />
<Button Content="ASDF" />
<Button Content="ASDF" />
<Button Content="ASDF" />
<Button Content="ASDF" />
<Button Content="ASDF" />
<Button Content="ASDF" />
<Button Content="ASDF" />
<Separator />
<Button Content="ASDF" />
<Button Content="ASDF" />
<Button Content="ASDF" />
<Button Content="ASDF" />
<Button Content="ASDF" />
<Button Content="ASDF" />
<Button Content="ASDF" />
<Button Content="ASDF" />
<Button Content="ASDF" />
</ToolBar>
</Grid>
it seems that a WPF Separator doesn't show up in a ToolBar's Overflow panel when you shrink the size of the toolbar; is there someway to make it show? (I can get around it by using an empty colored label, but I'd still like to know why separators don't work).
An example: create a new WPF project with in the mainwindow.xaml:
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<ToolBar HorizontalAlignment="Left" Name="toolBar1">
<Button Content="ASDF" />
<Button Content="ASDF" />
<Button Content="ASDF" />
<Button Content="ASDF" />
<Button Content="ASDF" />
<Button Content="ASDF" />
<Button Content="ASDF" />
<Button Content="ASDF" />
<Separator />
<Button Content="ASDF" />
<Button Content="ASDF" />
<Button Content="ASDF" />
<Button Content="ASDF" />
<Button Content="ASDF" />
<Button Content="ASDF" />
<Button Content="ASDF" />
<Button Content="ASDF" />
<Button Content="ASDF" />
</ToolBar>
</Grid>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我的问题在MSDN上得到了解答;你需要将它包裹在网格中并将其旋转 90 度:
但是在我的实际项目中,由于某种原因我不需要进行旋转。
My problem was answered on MSDN; you need to wrap it in a grid and rotate it 90 degrees:
However in my actual project I didn't need to do the rotation for some reason or other.
请尝试一下,这显示了带有溢出的分隔符,您可以通过“overflowmode”属性设置每个元素的溢出。
希望这对您有帮助。
Please try it this is showing separator with overflow and you can set the overflow with each element by "overflowmode" property.
Hope this help you.