一、Expander的用法
在WPF中,Expander是一个很实用的复合控件,可以很方便的实现下拉菜单和导航栏等功能。先介绍简单的用法,而后分析他的控件模板。
<Window.Resources> <ResourceDictionary> <Style x:Key="Expander.StackPanel.Style" TargetType="FrameworkElement"> <Setter Property="MaxWidth" Value="80"></Setter> <Setter Property="MinWidth" Value="50"></Setter> <Setter Property="HorizontalAlignment" Value="Left"></Setter> </Style> </ResourceDictionary> </Window.Resources> <Grid> <Expander Style="{DynamicResource ExpanderStyle}" Header="头部"> <StackPanel> <Button Style="{StaticResource Expander.StackPanel.Style}">内容1</Button> <RadioButton Style="{StaticResource Expander.StackPanel.Style}">内容2</RadioButton> <TextBox Style="{StaticResource Expander.StackPanel.Style}">内容3</TextBox> <TextBlock Style="{StaticResource Expander.StackPanel.Style}">内容4</TextBlock> </StackPanel> </Expander> </Grid>
讯享网

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容,请联系我们,一经查实,本站将立刻删除。
如需转载请保留出处:https://51itzy.com/kjqy/44688.html