简体   繁体   English

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

[英]How do I add a bullet point in front of a text binding in wpf?

I have the following abbreviated for simplicity 为简单起见,我有以下缩写

<ItemsControl ItemSource="{Binding enumerableList}">
    <ItemsControl.ItemTemplate>
        <DataTemplate>
            <TextBox Text="{Binding displayName, Mode=OneWay}" />
        </DataTemplate>
    </ItemsControl.ItemTemplate>
</ItemsControl>

How can I get it so that my TextBox shows a bullet point in front of the text bound to it? 我怎样才能得到它以便我的TextBox在绑定到它的文本前面显示一个子弹点? Desired format: 所需格式:

  • List item 1 清单项目1
  • List item 2 清单项目2

You can use the BulletDecorator with the TextBlock. 您可以将BulletDecorator与TextBlock一起使用。 Example: 例:

    <BulletDecorator>
      <BulletDecorator.Bullet>
        <Ellipse Height="10" Width="10" Fill="Blue"/>
      </BulletDecorator.Bullet>
        <TextBox Text="{Binding displayName, Mode=OneWay}" />
    </BulletDecorator>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM