【问题标题】:Bullets in a Xaml TooltipXaml 工具提示中的项目符号
【发布时间】:2013-10-31 06:00:13
【问题描述】:

一切都在标题中。我希望能够在工具提示中添加一些项目符号列表,但到目前为止还没有找到任何简单的方法。

提前致谢!

【问题讨论】:

  • 你试过我给出的答案了吗?
  • 参见。我的 cmets 在你的回答中

标签: c# wpf list xaml


【解决方案1】:

您希望将BulletDecorator 用作ToolTip 的一部分。示例:

      <ToolTip>
        <BulletDecorator>
          <BulletDecorator.Bullet>
            <Ellipse Height="10" Width="10" Fill="Blue"/>
          </BulletDecorator.Bullet>
          <TextBlock>Text with a bullet!</TextBlock>
        </BulletDecorator>
      </ToolTip>

欲了解更多信息,请参阅http://msdn.microsoft.com/en-us/library/system.windows.controls.primitives.bulletdecorator(v=vs.100).aspx

【讨论】:

  • 非常感谢。似乎是迄今为止最好的方法并且运作良好!不过,似乎我必须为每一个子弹添加一些装饰器?有什么提示不要每次都申报吗?
  • 是的,您每次都必须添加一个。您可以将其包装在 ItemsPanel 中,并使用字符串集合绑定它。在 ItemsPanel 数据模板中,您只能指定一个 BulletDecorator。
【解决方案2】:

你必须有一个自定义的工具提示

一个不错的博客示例 http://stevenhollidge.blogspot.co.il/2012/04/custom-tooltip-and-popup.html

微软信息 http://msdn.microsoft.com/en-us/library/ms745107.aspx

只需在内容中添加某种富文本框或列表框...

【讨论】:

    【解决方案3】:

    只是猜测:
    为什么不使用 unicode characters(例如 0x2981)和 \r\n 进行谎言休息?

    【讨论】:

      【解决方案4】:

      我通过以下方式正确显示了它:

      <ListView
              x:Name="listView"
              Margin="0,-5,0,0"
              BackgroundColor="Transparent"
              HasUnevenRows="True"
              HeightRequest="50"
              HorizontalOptions="CenterAndExpand"
              ItemsSource="{Binding TradingHoursList}"
              SeparatorColor="Transparent">
          <ListView.ItemTemplate>
              <DataTemplate>
                  <ViewCell>
                      <RelativeLayout>
                          <Label Text="&#x2022;"/>
                          <Label
                                  Margin="10,0,0,0"
                                  FontAttributes="Italic"
                                  FontFamily="Arial Black"
                                  FontSize="15"
                                  HorizontalOptions="Start"
                                  Text="{Binding}"
                                  VerticalOptions="Start"/>
                      </RelativeLayout>
                  </ViewCell>
              </DataTemplate>
          </ListView.ItemTemplate>
      </ListView>
      

      【讨论】:

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