Expander 中的元素怎么居中对齐

鏡椛氹鈅 2016-08-16 08:58:47
<Expander Style="{DynamicResource Expander}" VerticalContentAlignment="Center" HorizontalContentAlignment="Stretch"> <StackPanel VerticalAlignment="Center" HorizontalAlignment="Center" >
<control:IconRadioButton >AAAA</control:IconRadioButton>
<control:IconRadioButton >BBBB</control:IconRadioButton>
</StackPanel>
</Expander>
上面代码展示如下图



怎么让Expander 里面的control:IconRadioButton 自动最大化填充和居中
望大神指点
...全文
711 2 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
鏡椛氹鈅 2016-08-17
  • 打赏
  • 举报
回复
引用 1 楼 duanzi_peng 的回复:
你让你的control:IconRadioButton HorizontalAlignment="Center" 不行么? 看看 你的自定义控件 有没有margin之类的属性设置
不行,如果把control:IconRadioButton不放在Expander里面,放在比如StackPanel里面就可以实现填充和居中 我发的这段代码如果给Expander里面的StackPanel设置Width的话,就可以实现填充和居中,不设置width就不行
  • 打赏
  • 举报
回复
你让你的control:IconRadioButton HorizontalAlignment="Center" 不行么? 看看 你的自定义控件 有没有margin之类的属性设置

8,756

社区成员

发帖
与我相关
我的任务
社区描述
WPF/Silverlight相关讨论
社区管理员
  • WPF/Silverlight社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧