简体   繁体   English

WPF +扩展器控制问题

[英]WPF + Expander control issue

I have a WPF application in which i want to add "Expander" control. 我有一个WPF应用程序,我想在其中添加“ Expander”控件。

The XAML code is like this XAML代码是这样的

<Expander Header="More Options" Margin="30,286,0,0"  Height="145" Width="547">
   <Grid>
      <TextBox Height="104" HorizontalAlignment="Left" Margin="30,286,0,0" Name="logsTextBox" VerticalAlignment="Top" Width="547" 
             ScrollViewer.VerticalScrollBarVisibility="Auto" ScrollViewer.HorizontalScrollBarVisibility="Auto" ScrollViewer.CanContentScroll="True" />
   </Grid>
</Expander>

The textBox gets updated with the output of the bat file(which runs using Process). 使用bat文件(使用Process运行)的输出更新文本框。

when I run my application, textBox is not visible when expanding the expander. 当我运行我的应用程序时,扩展扩展器时textBox不可见。

What property I have to set to make it visible when expanding the expander? 展开扩展器时,我必须设置什么属性才能使其可见?

Thanks 谢谢

The margin property is applied to the parent's region. margin属性应用于父级区域。

Your declaration... 你的声明...

<TextBox Height="104" HorizontalAlignment="Left" Margin="30,286,0,0" Name="logsTextBox" VerticalAlignment="Top" Width="547" 
             ScrollViewer.VerticalScrollBarVisibility="Auto" ScrollViewer.HorizontalScrollBarVisibility="Auto" ScrollViewer.CanContentScroll="True" />

...indicates that the TextBox should appear inside the Expander and 286 units BELOW the Exander's top. ...表示TextBox应该出现在Expander内部,并且在Exander顶部下方286个单位内。 Remove the TextBox margin and you will see it as expected. 删除文本框边距,您将看到预期的样子。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM