【问题标题】:Custom WPF list control自定义 WPF 列表控件
【发布时间】:2013-10-31 16:55:52
【问题描述】:

我想构建一个像

一样工作的 WPF 控件

这是 Outlook 导航的一部分。

我不确定要使用选项卡控件还是列表控件。

如果您也可以参考示例,那将非常有帮助。

提前致谢, KD

【问题讨论】:

  • 您不必从头开始构建自己的控件来实现此目的。你可以使用这个项目:navigationpane.codeplex.com.
  • 听起来你可以使用标准的 WPF 机制来做到这一点,例如 ItemTemplate GroupStyle 和 CollectionView。
  • 这和Expander有什么区别?

标签: .net wpf mvvm controls


【解决方案1】:

查看Expander 控件。这是一个可折叠的内容面板,您可以在其中单击标题以展开或折叠内容。

这应该会给你类似上面的“当前视图”面板:

<Border BorderThickness="0,0,0,2" BorderBrush="LightBlue" >
    <Expander IsExpanded="True" Name="expander" Background="#FFB5E1F3">
        <Expander.Header>
            <TextBlock Text="Current View" Background="#FFB5E1F3" Foreground="#FF166CD3" FontWeight="Bold" Padding="4,1,75,1"/>
        </Expander.Header>
        <Expander.Content>
            <Grid Background="White">
                <StackPanel Margin="20,0,0,0">
                    <RadioButton Content="Business Cards" Margin="2"/>
                    <RadioButton Content="Address Cards" Margin="2"/>
                    <RadioButton Content="Phone List" Margin="2"/>
                </StackPanel>
            </Grid>
        </Expander.Content>
    </Expander>
</Border>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-02-22
    • 1970-01-01
    相关资源
    最近更新 更多