扩展器扩展按钮的移动位置 wpf [英] Moving location of Expander expansion button wpf

查看:30
本文介绍了扩展器扩展按钮的移动位置 wpf的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是使用 wpf 的新手,想使用扩展器来允许用户显示和隐藏文本.我希望扩展器容器是窗口高度 800 的整个长度.我希望扩展器向右扩展并且文本和扩展器按钮位于扩展器的中心.

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.

任何帮助将不胜感激.

推荐答案

好消息是这是可能的……坏消息是它不像在 Expander 上设置一些属性来移动按钮那么简单.

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...

这篇关于扩展器扩展按钮的移动位置 wpf的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆