BulletDecorator.Bullet 属性

定义

获取或设置要在 BulletDecorator 中用作项目符号的对象。

public:
 property System::Windows::UIElement ^ Bullet { System::Windows::UIElement ^ get(); void set(System::Windows::UIElement ^ value); };
public System.Windows.UIElement Bullet { get; set; }
member this.Bullet : System.Windows.UIElement with get, set
Public Property Bullet As UIElement

属性值

UIElement

要用作项目符号的 UIElement。 默认值为 null

示例

以下示例演示如何设置 Bullet 属性。

BulletDecorator bp = new BulletDecorator();
Image i = new Image();
BitmapImage bi= new BitmapImage(); 
bi.UriSource = new Uri(@"pack://application:,,/images/icon.jpg");
i.Source = bi;
i.Width = 10;
bp.Bullet = i;
TextBlock tb = new TextBlock();
tb.Text = "My Expander";
tb.Margin = new Thickness(20,0,0,0);     
bp.Child = tb;
Dim bp As BulletDecorator = New BulletDecorator()
Dim i As Image = New Image()
Dim bi As BitmapImage = New BitmapImage()
bi.UriSource = New Uri("pack://application:,,./images/icon.jpg")
i.Source = bi
i.Width = 10
bp.Bullet = i
Dim tb As TextBlock = New TextBlock()
tb.Text = "My Expander"
tb.Margin = New Thickness(20, 0, 0, 0)
bp.Child = tb
<BulletDecorator>
  <BulletDecorator.Bullet>
    <Image Width="10" Source="images\icon.jpg"/>
  </BulletDecorator.Bullet>
  <TextBlock Margin="20,0,0,0">My Expander</TextBlock>
</BulletDecorator>

注解

Bullet 属性是控件的内容 BulletDecorator 属性,并定义 UIElement 要显示为对象的项目符号 Child

通过将属性设置为 Bullet 控件 UIElement 中的第一个 BulletDecorator 视觉元素来定义的项目符号。 单个 Child 元素是第二个视觉对象元素。

XAML 属性元素用法

<object>  
  <object.Bullet>  
    <UIElement .../>  
  </object.Bullet>  
</object>  

适用于

另请参阅