Moving location of Expander expansion button wpf

徘徊边缘 提交于 2019-12-11 03:54:15

问题


I am new to using wpf and want to use expander to allow the user to show and hide text. I want the expander container to be the entire length of the window height 800. I want to have the expander expand to the right and have the text and expander button be in the center of the expander.

I know how to make the expander expand to the right and how to change orientation of the text with a textblock. I can not figure out how to make the location of the text and the button move to the center of the expander.

Any help would be much appreciated.


回答1:


The good news is that this is possible... the bad news is that it is not as trivial as setting some property on the Expander to move the button around.

In order to create the effect you are after, you're going to have to write a custom ControlTemplate for the Expander.

Here's a nice tutorial showing you how to achieve this...



来源:https://stackoverflow.com/questions/3095544/moving-location-of-expander-expansion-button-wpf

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!