WPF Expander:反转图标方向,同时保持内容位置(ExpandDirection)相同
我将 WPF 扩展器用作抽屉,它向上扩展,使标题保持在内容之上。当它折叠时,它所在的网格单元也会变小。
我希望展开方向保持向下,以便内容填充在其下方,但是因为它向上移动,所以如果带有方向箭头的图标位于相反方向(就像 ExandDirection 属性设置为向上一样),看起来会更好。如何在 C# 代码或 XAML 中完成此操作。
谢谢
I am using the WPF expander like a drawer, it expands up out so that the header remains above the content. When it is collapsed the grid cell that it is in is made smaller as well.
I want the expand direction to remain down so that the content fills in below it, however because it moves up it would look better if the icon with the directional arrow were in the opposite direction as if the ExandDirection property were set to Up. How can this be done in either C# code or in the XAML.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果我正确理解您想要将箭头交换为扩展器折叠/扩展状态,则您需要为扩展器创建自定义控件模板。
我知道的最简单的方法是从 wpf 主题获取扩展器控件模板并将样式重命名为:
ExpanderDownHeaderStyle
ExpanderUpHeaderStyle
您可以从这里下载主题源
http://msdn.microsoft.com/en-us /library/aa358533(VS.90).aspx
如果您对此有任何问题,请告诉我您使用的 wpf 主题,我将为您提供 xaml。
另请参阅如何使用 Blend 自定义 Expander
http://www.c-sharpcorner.com/uploadfile/dpatra/ 807/默认.aspx
If I understand correctly that you want to swap arrows for expander collapsed/expanded state, you'll need to create a custom control template for expander.
The easiest way I know to do that is to get expander control template from wpf theme and rename styles:
ExpanderDownHeaderStyle
ExpanderUpHeaderStyle
You can download themes sources from here
http://msdn.microsoft.com/en-us/library/aa358533(VS.90).aspx
If you'll have any issues with that, let me know what wpf theme are you using and I'll make you the xaml.
Also have a look how to customize Expander with Blend
http://www.c-sharpcorner.com/uploadfile/dpatra/807/default.aspx