WPF 数据绑定(bind)项目符号列表

标签 wpf itemscontrol

如何在 WPF 中创建数据绑定(bind)、项目符号的超链接列表?

我有这个:

<ItemsControl Name="lstScripts">
    <ItemsControl.ItemTemplate>
        <DataTemplate>
            <TextBlock>
                <Hyperlink>
                    <TextBlock Text="{Binding Path=Name}" />
                </Hyperlink>
            </TextBlock>
        </DataTemplate>
    </ItemsControl.ItemTemplate>
</ItemsControl>

但我不知道如何将这些元素变成子弹。我看到 BulletDecorator,但我不想指定自己的项目符号图像,我只想要标准项目符号。

最佳答案

不幸的是,没有“标准项目符号”......这是一个简单的椭圆项目符号的示例:

        <ItemsControl Name="lstScripts">
            <ItemsControl.ItemTemplate>
                <DataTemplate>
                    <BulletDecorator Width="Auto">
                        <BulletDecorator.Bullet>
                            <Ellipse Fill="White" Stroke="Black" StrokeThickness="1" Width="8" Height="8"/>
                        </BulletDecorator.Bullet>
                        <TextBlock>
                            <Hyperlink>
                                <TextBlock Text="{Binding Path=Name}" />
                            </Hyperlink>
                        </TextBlock>
                    </BulletDecorator>
                </DataTemplate>
            </ItemsControl.ItemTemplate>
        </ItemsControl>

关于WPF 数据绑定(bind)项目符号列表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/870277/

相关文章:

c# - 根据 Switch 语句获取值

c# - WinRT 信息 : Cannot find a resource with the given key. 转换器引用问题

.net - WPF Frame 和 WebBrowser 控件之间的差异

wpf - ItemsControl 缺少垂直滚动条

xaml - 将PopUp放置在Itemscontrol中

c# - 如何以排序方式显示 int 的数据绑定(bind)集合

c# - OpacityMask 无法按预期在 C# 代码中工作

c# - 如何针对特定条件扩展 WPF 窗口?

C# WPF 使用 ItemsControl 管理嵌套结构

silverlight - 创建一个无限的 Silverlight ItemsControl