• 根据Expander的IsExpanded属性值的变化动态设计Control的size


    简要说明:

    当Expander 的IsExpanded属性为“True” 时给控件设个尺寸(此处为高度),当为“False”时给控件设另外一个值。

    知识点:数据绑定、Style和Trigger

          <Grid>
            <Grid.RowDefinitions>
                <RowDefinition>
                    <RowDefinition.Style>
                        <Style TargetType="RowDefinition">
                            <Setter Property="Height" Value="25" />
                            <Style.Triggers>
                                <DataTrigger Binding="{Binding ElementName=testExpander,Path=IsExpanded}" Value="True">
                                    <Setter Property="Height" Value="205" />
                                </DataTrigger>
                            </Style.Triggers>
                        </Style>
                    </RowDefinition.Style>
                </RowDefinition>
                <RowDefinition Height="*" />
            </Grid.RowDefinitions>
                
            <Expander Header="Haha"  x:Name="testExpander" />
            <StackPanel Grid.Row="1" >
                <TabControl>
                    <TabItem Header="HaHaTabItem" >
                        <ListBox>
                            <ListBoxItem Content="Blue" />
                            <ListBoxItem Content="Black" />
                            <ListBoxItem Content="Red" />
                        </ListBox>
                     </TabItem>
                </TabControl>
            </StackPanel>
        </Grid>

  • 相关阅读:
    如何在CentOS 7中安装最新Git(源码安装)
    centos7安装Lua
    syslog-ng 学习
    syslog-ng内容讲解
    java框架篇---spring IOC 实现原理
    java 过滤器filter使用案例
    jsp-TagLib标签库
    阿里服务器+Centos7.4+Tomcat+JDK部署
    IntelliJ IDEA上创建maven Spring MVC项目
    ServiceStack.Redis之IRedisClient
  • 原文地址:https://www.cnblogs.com/NaughtyCat/p/5621647.html
Copyright © 2020-2023  润新知