Example #1
0
 private Control Template(ListBoxItem control)
 {
     return new Border
     {
         Name = "border",
         [~Border.BackgroundProperty] = control[~ListBoxItem.BackgroundProperty],
         [~Border.BorderBrushProperty] = control[~ListBoxItem.BorderBrushProperty],
         [~Border.BorderThicknessProperty] = control[~ListBoxItem.BorderThicknessProperty],
         Content = new ContentPresenter
         {
             [~ContentPresenter.ContentProperty] = control[~ListBoxItem.ContentProperty],
         },
     };
 }
Example #2
0
 /// <summary>
 /// The default template for a <see cref="ListBoxItem"/> control.
 /// </summary>
 /// <param name="control">The control being styled.</param>
 /// <returns>The root of the instantiated template.</returns>
 public static Control Template(ListBoxItem control)
 {
     return new Border
     {
         Name = "border",
         [~Border.BackgroundProperty] = control[~TemplatedControl.BackgroundProperty],
         [~Border.BorderBrushProperty] = control[~TemplatedControl.BorderBrushProperty],
         [~Border.BorderThicknessProperty] = control[~TemplatedControl.BorderThicknessProperty],
         Child = new ContentPresenter
         {
             [~ContentPresenter.ContentProperty] = control[~ContentControl.ContentProperty],
         },
     };
 }