如何进行WPF扩展器拉伸? [英] How can I make a WPF Expander Stretch?

查看:70
本文介绍了如何进行WPF扩展器拉伸?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

WPF中的 Expander 控件不会拉伸以填充所有可用空间.XAML中有什么解决方案吗?

The Expander control in WPF does not stretch to fill all the available space. Is there any solutions in XAML for this?

推荐答案

您所需要做的就是:

<Expander>
  <Expander.Header>
    <TextBlock
      Text="I am header text..."
      Background="Blue"
      Width="{Binding
        RelativeSource={RelativeSource
          Mode=FindAncestor,
          AncestorType={x:Type Expander}},
        Path=ActualWidth}"
      />
  </Expander.Header>
  <TextBlock Background="Red">
    I am some content...
  </TextBlock>
</Expander>

http://joshsmithonwpf.wordpress.com/2007/02/24/stretching-content-in-an-expander-header/

这篇关于如何进行WPF扩展器拉伸?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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