如何在wpf中的文本绑定前添加项目符号?

Lun*_*nyx 16 c# wpf xaml decorator

为简单起见,我有以下缩写

<ItemsControl ItemSource="{Binding enumerableList}">
    <ItemsControl.ItemTemplate>
        <DataTemplate>
            <TextBox Text="{Binding displayName, Mode=OneWay}" />
        </DataTemplate>
    </ItemsControl.ItemTemplate>
</ItemsControl>
Run Code Online (Sandbox Code Playgroud)

我怎样才能得到它以便我的TextBox在绑定到它的文本前面显示一个子弹点?所需格式:

  • 清单项目1
  • 清单项目2

Saj*_*ran 27

您可以使用BulletDecoratorTextBlock.例:

    <BulletDecorator>
      <BulletDecorator.Bullet>
        <Ellipse Height="10" Width="10" Fill="Blue"/>
      </BulletDecorator.Bullet>
        <TextBox Text="{Binding displayName, Mode=OneWay}" />
    </BulletDecorator>
Run Code Online (Sandbox Code Playgroud)

  • 使用FlowDocument http://msdn.microsoft.com/en-us/library/system.windows.documents.list.aspx (3认同)