Browse Source

Merge pull request #7911 from robloo/add-template-parts

Add Template Part Attributes to Controls
pull/8045/head
Max Katz 5 years ago
committed by Steven Kirk
parent
commit
c877c1b46c
  1. 4
      src/Avalonia.Controls/AutoCompleteBox.cs
  2. 2
      src/Avalonia.Controls/ButtonSpinner.cs
  3. 21
      src/Avalonia.Controls/Calendar/Calendar.cs
  4. 5
      src/Avalonia.Controls/Calendar/CalendarDatePicker.cs
  5. 5
      src/Avalonia.Controls/Calendar/CalendarItem.cs
  6. 4
      src/Avalonia.Controls/Chrome/CaptionButtons.cs
  7. 1
      src/Avalonia.Controls/Chrome/TitleBar.cs
  8. 2
      src/Avalonia.Controls/ComboBox.cs
  9. 2
      src/Avalonia.Controls/ContentControl.cs
  10. 9
      src/Avalonia.Controls/DateTimePickers/DatePicker.cs
  11. 20
      src/Avalonia.Controls/DateTimePickers/DatePickerPresenter.cs
  12. 12
      src/Avalonia.Controls/DateTimePickers/TimePicker.cs
  13. 17
      src/Avalonia.Controls/DateTimePickers/TimePickerPresenter.cs
  14. 2
      src/Avalonia.Controls/ListBox.cs
  15. 1
      src/Avalonia.Controls/MenuItem.cs
  16. 1
      src/Avalonia.Controls/Notifications/WindowNotificationManager.cs
  17. 3
      src/Avalonia.Controls/NumericUpDown/NumericUpDown.cs
  18. 4
      src/Avalonia.Controls/Primitives/ScrollBar.cs
  19. 1
      src/Avalonia.Controls/ProgressBar.cs
  20. 3
      src/Avalonia.Controls/ScrollViewer.cs
  21. 3
      src/Avalonia.Controls/Slider.cs
  22. 1
      src/Avalonia.Controls/SplitView.cs
  23. 2
      src/Avalonia.Controls/TabControl.cs
  24. 1
      src/Avalonia.Controls/TextBox.cs
  25. 2
      src/Avalonia.Controls/ToggleSwitch.cs
  26. 2
      src/Avalonia.Controls/TopLevel.cs
  27. 1
      src/Avalonia.Controls/TreeViewItem.cs

4
src/Avalonia.Controls/AutoCompleteBox.cs

@ -252,6 +252,10 @@ namespace Avalonia.Controls
/// drop-down that contains possible matches based on the input in the text /// drop-down that contains possible matches based on the input in the text
/// box. /// box.
/// </summary> /// </summary>
[TemplatePart(ElementPopup, typeof(Popup))]
[TemplatePart(ElementSelector, typeof(SelectingItemsControl))]
[TemplatePart(ElementSelectionAdapter, typeof(ISelectionAdapter))]
[TemplatePart(ElementTextBox, typeof(TextBox))]
[PseudoClasses(":dropdownopen")] [PseudoClasses(":dropdownopen")]
public class AutoCompleteBox : TemplatedControl public class AutoCompleteBox : TemplatedControl
{ {

2
src/Avalonia.Controls/ButtonSpinner.cs

@ -16,6 +16,8 @@ namespace Avalonia.Controls
/// <summary> /// <summary>
/// Represents a spinner control that includes two Buttons. /// Represents a spinner control that includes two Buttons.
/// </summary> /// </summary>
[TemplatePart("PART_DecreaseButton", typeof(Button))]
[TemplatePart("PART_IncreaseButton", typeof(Button))]
[PseudoClasses(":left", ":right")] [PseudoClasses(":left", ":right")]
public class ButtonSpinner : Spinner public class ButtonSpinner : Spinner
{ {

21
src/Avalonia.Controls/Calendar/Calendar.cs

@ -6,6 +6,7 @@
using System; using System;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.Diagnostics; using System.Diagnostics;
using Avalonia.Controls.Metadata;
using Avalonia.Controls.Primitives; using Avalonia.Controls.Primitives;
using Avalonia.Data; using Avalonia.Data;
using Avalonia.Input; using Avalonia.Input;
@ -222,6 +223,8 @@ namespace Avalonia.Controls
/// element in XAML. /// element in XAML.
/// </para> /// </para>
/// </remarks> /// </remarks>
[TemplatePart(PART_ElementMonth, typeof(CalendarItem))]
[TemplatePart(PART_ElementRoot, typeof(Panel))]
public class Calendar : TemplatedControl public class Calendar : TemplatedControl
{ {
internal const int RowsPerMonth = 7; internal const int RowsPerMonth = 7;
@ -261,6 +264,7 @@ namespace Avalonia.Controls
AvaloniaProperty.Register<Calendar, DayOfWeek>( AvaloniaProperty.Register<Calendar, DayOfWeek>(
nameof(FirstDayOfWeek), nameof(FirstDayOfWeek),
defaultValue: DateTimeHelper.GetCurrentDateFormat().FirstDayOfWeek); defaultValue: DateTimeHelper.GetCurrentDateFormat().FirstDayOfWeek);
/// <summary> /// <summary>
/// Gets or sets the day that is considered the beginning of the week. /// Gets or sets the day that is considered the beginning of the week.
/// </summary> /// </summary>
@ -273,6 +277,7 @@ namespace Avalonia.Controls
get { return GetValue(FirstDayOfWeekProperty); } get { return GetValue(FirstDayOfWeekProperty); }
set { SetValue(FirstDayOfWeekProperty, value); } set { SetValue(FirstDayOfWeekProperty, value); }
} }
/// <summary> /// <summary>
/// FirstDayOfWeekProperty property changed handler. /// FirstDayOfWeekProperty property changed handler.
/// </summary> /// </summary>
@ -289,6 +294,7 @@ namespace Avalonia.Controls
throw new ArgumentOutOfRangeException("d", "Invalid DayOfWeek"); throw new ArgumentOutOfRangeException("d", "Invalid DayOfWeek");
} }
} }
/// <summary> /// <summary>
/// Inherited code: Requires comment. /// Inherited code: Requires comment.
/// </summary> /// </summary>
@ -311,6 +317,7 @@ namespace Avalonia.Controls
AvaloniaProperty.Register<Calendar, bool>( AvaloniaProperty.Register<Calendar, bool>(
nameof(IsTodayHighlighted), nameof(IsTodayHighlighted),
defaultValue: true); defaultValue: true);
/// <summary> /// <summary>
/// Gets or sets a value indicating whether the current date is /// Gets or sets a value indicating whether the current date is
/// highlighted. /// highlighted.
@ -324,6 +331,7 @@ namespace Avalonia.Controls
get { return GetValue(IsTodayHighlightedProperty); } get { return GetValue(IsTodayHighlightedProperty); }
set { SetValue(IsTodayHighlightedProperty, value); } set { SetValue(IsTodayHighlightedProperty, value); }
} }
/// <summary> /// <summary>
/// IsTodayHighlightedProperty property changed handler. /// IsTodayHighlightedProperty property changed handler.
/// </summary> /// </summary>
@ -343,6 +351,7 @@ namespace Avalonia.Controls
public static readonly StyledProperty<IBrush> HeaderBackgroundProperty = public static readonly StyledProperty<IBrush> HeaderBackgroundProperty =
AvaloniaProperty.Register<Calendar, IBrush>(nameof(HeaderBackground)); AvaloniaProperty.Register<Calendar, IBrush>(nameof(HeaderBackground));
public IBrush HeaderBackground public IBrush HeaderBackground
{ {
get { return GetValue(HeaderBackgroundProperty); } get { return GetValue(HeaderBackgroundProperty); }
@ -367,6 +376,7 @@ namespace Avalonia.Controls
get { return GetValue(DisplayModeProperty); } get { return GetValue(DisplayModeProperty); }
set { SetValue(DisplayModeProperty, value); } set { SetValue(DisplayModeProperty, value); }
} }
/// <summary> /// <summary>
/// DisplayModeProperty property changed handler. /// DisplayModeProperty property changed handler.
/// </summary> /// </summary>
@ -424,6 +434,7 @@ namespace Avalonia.Controls
|| mode == CalendarMode.Year || mode == CalendarMode.Year
|| mode == CalendarMode.Decade; || mode == CalendarMode.Decade;
} }
private void OnDisplayModeChanged(CalendarModeChangedEventArgs args) private void OnDisplayModeChanged(CalendarModeChangedEventArgs args)
{ {
DisplayModeChanged?.Invoke(this, args); DisplayModeChanged?.Invoke(this, args);
@ -433,6 +444,7 @@ namespace Avalonia.Controls
AvaloniaProperty.Register<Calendar, CalendarSelectionMode>( AvaloniaProperty.Register<Calendar, CalendarSelectionMode>(
nameof(SelectionMode), nameof(SelectionMode),
defaultValue: CalendarSelectionMode.SingleDate); defaultValue: CalendarSelectionMode.SingleDate);
/// <summary> /// <summary>
/// Gets or sets a value that indicates what kind of selections are /// Gets or sets a value that indicates what kind of selections are
/// allowed. /// allowed.
@ -457,6 +469,7 @@ namespace Avalonia.Controls
get { return GetValue(SelectionModeProperty); } get { return GetValue(SelectionModeProperty); }
set { SetValue(SelectionModeProperty, value); } set { SetValue(SelectionModeProperty, value); }
} }
private void OnSelectionModeChanged(AvaloniaPropertyChangedEventArgs e) private void OnSelectionModeChanged(AvaloniaPropertyChangedEventArgs e)
{ {
if (IsValidSelectionMode(e.NewValue)) if (IsValidSelectionMode(e.NewValue))
@ -471,6 +484,7 @@ namespace Avalonia.Controls
throw new ArgumentOutOfRangeException("d", "Invalid SelectionMode"); throw new ArgumentOutOfRangeException("d", "Invalid SelectionMode");
} }
} }
/// <summary> /// <summary>
/// Inherited code: Requires comment. /// Inherited code: Requires comment.
/// </summary> /// </summary>
@ -492,6 +506,7 @@ namespace Avalonia.Controls
o => o.SelectedDate, o => o.SelectedDate,
(o, v) => o.SelectedDate = v, (o, v) => o.SelectedDate = v,
defaultBindingMode: BindingMode.TwoWay); defaultBindingMode: BindingMode.TwoWay);
/// <summary> /// <summary>
/// Gets or sets the currently selected date. /// Gets or sets the currently selected date.
/// </summary> /// </summary>
@ -720,6 +735,7 @@ namespace Avalonia.Controls
o => o.DisplayDate, o => o.DisplayDate,
(o, v) => o.DisplayDate = v, (o, v) => o.DisplayDate = v,
defaultBindingMode: BindingMode.TwoWay); defaultBindingMode: BindingMode.TwoWay);
/// <summary> /// <summary>
/// Gets or sets the date to display. /// Gets or sets the date to display.
/// </summary> /// </summary>
@ -1959,6 +1975,7 @@ namespace Avalonia.Controls
} }
} }
} }
private void Calendar_KeyUp(KeyEventArgs e) private void Calendar_KeyUp(KeyEventArgs e)
{ {
if (!e.Handled && (e.Key == Key.LeftShift || e.Key == Key.RightShift)) if (!e.Handled && (e.Key == Key.LeftShift || e.Key == Key.RightShift))
@ -1966,6 +1983,7 @@ namespace Avalonia.Controls
ProcessShiftKeyUp(); ProcessShiftKeyUp();
} }
} }
internal void ProcessShiftKeyUp() internal void ProcessShiftKeyUp()
{ {
if (_isShiftPressed && (SelectionMode == CalendarSelectionMode.SingleRange || SelectionMode == CalendarSelectionMode.MultipleRange)) if (_isShiftPressed && (SelectionMode == CalendarSelectionMode.SingleRange || SelectionMode == CalendarSelectionMode.MultipleRange))
@ -2014,6 +2032,7 @@ namespace Avalonia.Controls
} }
} }
} }
protected override void OnLostFocus(RoutedEventArgs e) protected override void OnLostFocus(RoutedEventArgs e)
{ {
base.OnLostFocus(e); base.OnLostFocus(e);
@ -2040,6 +2059,7 @@ namespace Avalonia.Controls
} }
} }
} }
/// <summary> /// <summary>
/// Called when the IsEnabled property changes. /// Called when the IsEnabled property changes.
/// </summary> /// </summary>
@ -2084,6 +2104,7 @@ namespace Avalonia.Controls
private const string PART_ElementRoot = "Root"; private const string PART_ElementRoot = "Root";
private const string PART_ElementMonth = "CalendarItem"; private const string PART_ElementMonth = "CalendarItem";
/// <summary> /// <summary>
/// Builds the visual tree for the /// Builds the visual tree for the
/// <see cref="T:System.Windows.Controls.Calendar" /> when a new /// <see cref="T:System.Windows.Controls.Calendar" /> when a new

5
src/Avalonia.Controls/Calendar/CalendarDatePicker.cs

@ -7,6 +7,7 @@ using System;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.Diagnostics; using System.Diagnostics;
using System.Globalization; using System.Globalization;
using Avalonia.Controls.Metadata;
using Avalonia.Controls.Primitives; using Avalonia.Controls.Primitives;
using Avalonia.Data; using Avalonia.Data;
using Avalonia.Input; using Avalonia.Input;
@ -116,6 +117,10 @@ namespace Avalonia.Controls
Custom = 2 Custom = 2
} }
[TemplatePart(ElementButton, typeof(Button))]
[TemplatePart(ElementCalendar, typeof(Calendar))]
[TemplatePart(ElementPopup, typeof(Popup))]
[TemplatePart(ElementTextBox, typeof(TextBox))]
public class CalendarDatePicker : TemplatedControl public class CalendarDatePicker : TemplatedControl
{ {
private const string ElementTextBox = "PART_TextBox"; private const string ElementTextBox = "PART_TextBox";

5
src/Avalonia.Controls/Calendar/CalendarItem.cs

@ -19,6 +19,11 @@ namespace Avalonia.Controls.Primitives
/// Represents the currently displayed month or year on a /// Represents the currently displayed month or year on a
/// <see cref="T:Avalonia.Controls.Calendar" />. /// <see cref="T:Avalonia.Controls.Calendar" />.
/// </summary> /// </summary>
[TemplatePart(PART_ElementHeaderButton, typeof(Button))]
[TemplatePart(PART_ElementMonthView, typeof(Grid))]
[TemplatePart(PART_ElementNextButton, typeof(Button))]
[TemplatePart(PART_ElementPreviousButton, typeof(Button))]
[TemplatePart(PART_ElementYearView, typeof(Grid))]
[PseudoClasses(":calendardisabled")] [PseudoClasses(":calendardisabled")]
public sealed class CalendarItem : TemplatedControl public sealed class CalendarItem : TemplatedControl
{ {

4
src/Avalonia.Controls/Chrome/CaptionButtons.cs

@ -10,6 +10,10 @@ namespace Avalonia.Controls.Chrome
/// <summary> /// <summary>
/// Draws window minimize / maximize / close buttons in a <see cref="TitleBar"/> when managed client decorations are enabled. /// Draws window minimize / maximize / close buttons in a <see cref="TitleBar"/> when managed client decorations are enabled.
/// </summary> /// </summary>
[TemplatePart("PART_CloseButton", typeof(Panel))]
[TemplatePart("PART_RestoreButton", typeof(Panel))]
[TemplatePart("PART_MinimiseButton", typeof(Panel))]
[TemplatePart("PART_FullScreenButton", typeof(Panel))]
[PseudoClasses(":minimized", ":normal", ":maximized", ":fullscreen")] [PseudoClasses(":minimized", ":normal", ":maximized", ":fullscreen")]
public class CaptionButtons : TemplatedControl public class CaptionButtons : TemplatedControl
{ {

1
src/Avalonia.Controls/Chrome/TitleBar.cs

@ -10,6 +10,7 @@ namespace Avalonia.Controls.Chrome
/// <summary> /// <summary>
/// Draws a titlebar when managed client decorations are enabled. /// Draws a titlebar when managed client decorations are enabled.
/// </summary> /// </summary>
[TemplatePart("PART_CaptionButtons", typeof(CaptionButtons))]
[PseudoClasses(":minimized", ":normal", ":maximized", ":fullscreen")] [PseudoClasses(":minimized", ":normal", ":maximized", ":fullscreen")]
public class TitleBar : TemplatedControl public class TitleBar : TemplatedControl
{ {

2
src/Avalonia.Controls/ComboBox.cs

@ -14,12 +14,14 @@ using Avalonia.LogicalTree;
using Avalonia.Media; using Avalonia.Media;
using Avalonia.Threading; using Avalonia.Threading;
using Avalonia.VisualTree; using Avalonia.VisualTree;
using Avalonia.Controls.Metadata;
namespace Avalonia.Controls namespace Avalonia.Controls
{ {
/// <summary> /// <summary>
/// A drop-down list control. /// A drop-down list control.
/// </summary> /// </summary>
[TemplatePart("PART_Popup", typeof(Popup))]
public class ComboBox : SelectingItemsControl public class ComboBox : SelectingItemsControl
{ {
/// <summary> /// <summary>

2
src/Avalonia.Controls/ContentControl.cs

@ -1,4 +1,5 @@
using Avalonia.Collections; using Avalonia.Collections;
using Avalonia.Controls.Metadata;
using Avalonia.Controls.Mixins; using Avalonia.Controls.Mixins;
using Avalonia.Controls.Presenters; using Avalonia.Controls.Presenters;
using Avalonia.Controls.Primitives; using Avalonia.Controls.Primitives;
@ -12,6 +13,7 @@ namespace Avalonia.Controls
/// <summary> /// <summary>
/// Displays <see cref="Content"/> according to a <see cref="FuncDataTemplate"/>. /// Displays <see cref="Content"/> according to a <see cref="FuncDataTemplate"/>.
/// </summary> /// </summary>
[TemplatePart("PART_ContentPresenter", typeof(IContentPresenter))]
public class ContentControl : TemplatedControl, IContentControl, IContentPresenterHost public class ContentControl : TemplatedControl, IContentControl, IContentPresenterHost
{ {
/// <summary> /// <summary>

9
src/Avalonia.Controls/DateTimePickers/DatePicker.cs

@ -14,6 +14,15 @@ namespace Avalonia.Controls
/// <summary> /// <summary>
/// A control to allow the user to select a date /// A control to allow the user to select a date
/// </summary> /// </summary>
[TemplatePart("ButtonContentGrid", typeof(Grid))]
[TemplatePart("DayText", typeof(TextBlock))]
[TemplatePart("FirstSpacer", typeof(Rectangle))]
[TemplatePart("FlyoutButton", typeof(Button))]
[TemplatePart("MonthText", typeof(TextBlock))]
[TemplatePart("PickerPresenter", typeof(DatePickerPresenter))]
[TemplatePart("Popup", typeof(Popup))]
[TemplatePart("SecondSpacer", typeof(Rectangle))]
[TemplatePart("YearText", typeof(TextBlock))]
[PseudoClasses(":hasnodate")] [PseudoClasses(":hasnodate")]
public class DatePicker : TemplatedControl public class DatePicker : TemplatedControl
{ {

20
src/Avalonia.Controls/DateTimePickers/DatePickerPresenter.cs

@ -1,4 +1,5 @@
using Avalonia.Controls.Primitives; using Avalonia.Controls.Metadata;
using Avalonia.Controls.Primitives;
using Avalonia.Controls.Shapes; using Avalonia.Controls.Shapes;
using Avalonia.Input; using Avalonia.Input;
using Avalonia.Interactivity; using Avalonia.Interactivity;
@ -12,6 +13,23 @@ namespace Avalonia.Controls
/// Defines the presenter used for selecting a date for a /// Defines the presenter used for selecting a date for a
/// <see cref="DatePicker"/> /// <see cref="DatePicker"/>
/// </summary> /// </summary>
[TemplatePart("AcceptButton", typeof(Button))]
[TemplatePart("DayDownButton", typeof(RepeatButton))]
[TemplatePart("DayHost", typeof(Panel))]
[TemplatePart("DaySelector", typeof(DateTimePickerPanel))]
[TemplatePart("DayUpButton", typeof(RepeatButton))]
[TemplatePart("DismissButton", typeof(Button))]
[TemplatePart("FirstSpacer", typeof(Rectangle))]
[TemplatePart("MonthDownButton", typeof(RepeatButton))]
[TemplatePart("MonthHost", typeof(Panel))]
[TemplatePart("MonthSelector", typeof(DateTimePickerPanel))]
[TemplatePart("MonthUpButton", typeof(RepeatButton))]
[TemplatePart("PickerContainer", typeof(Grid))]
[TemplatePart("SecondSpacer", typeof(Rectangle))]
[TemplatePart("YearDownButton", typeof(RepeatButton))]
[TemplatePart("YearHost", typeof(Panel))]
[TemplatePart("YearSelector", typeof(DateTimePickerPanel))]
[TemplatePart("YearUpButton", typeof(RepeatButton))]
public class DatePickerPresenter : PickerPresenterBase public class DatePickerPresenter : PickerPresenterBase
{ {
/// <summary> /// <summary>

12
src/Avalonia.Controls/DateTimePickers/TimePicker.cs

@ -12,6 +12,18 @@ namespace Avalonia.Controls
/// <summary> /// <summary>
/// A control to allow the user to select a time. /// A control to allow the user to select a time.
/// </summary> /// </summary>
[TemplatePart("FirstColumnDivider", typeof(Rectangle))]
[TemplatePart("FirstPickerHost", typeof(Border))]
[TemplatePart("FlyoutButton", typeof(Button))]
[TemplatePart("FlyoutButtonContentGrid", typeof(Grid))]
[TemplatePart("HourTextBlock", typeof(TextBlock))]
[TemplatePart("MinuteTextBlock", typeof(TextBlock))]
[TemplatePart("PeriodTextBlock", typeof(TextBlock))]
[TemplatePart("PickerPresenter", typeof(TimePickerPresenter))]
[TemplatePart("Popup", typeof(Popup))]
[TemplatePart("SecondColumnDivider", typeof(Rectangle))]
[TemplatePart("SecondPickerHost", typeof(Border))]
[TemplatePart("ThirdPickerHost", typeof(Border))]
[PseudoClasses(":hasnotime")] [PseudoClasses(":hasnotime")]
public class TimePicker : TemplatedControl public class TimePicker : TemplatedControl
{ {

17
src/Avalonia.Controls/DateTimePickers/TimePickerPresenter.cs

@ -1,4 +1,5 @@
using Avalonia.Controls.Primitives; using Avalonia.Controls.Metadata;
using Avalonia.Controls.Primitives;
using Avalonia.Controls.Shapes; using Avalonia.Controls.Shapes;
using Avalonia.Input; using Avalonia.Input;
using Avalonia.Interactivity; using Avalonia.Interactivity;
@ -10,6 +11,20 @@ namespace Avalonia.Controls
/// Defines the presenter used for selecting a time. Intended for use with /// Defines the presenter used for selecting a time. Intended for use with
/// <see cref="TimePicker"/> but can be used independently /// <see cref="TimePicker"/> but can be used independently
/// </summary> /// </summary>
[TemplatePart("AcceptButton", typeof(Button))]
[TemplatePart("DismissButton", typeof(Button))]
[TemplatePart("HourDownButton", typeof(RepeatButton))]
[TemplatePart("HourSelector", typeof(DateTimePickerPanel))]
[TemplatePart("HourUpButton", typeof(RepeatButton))]
[TemplatePart("MinuteDownButton", typeof(RepeatButton))]
[TemplatePart("MinuteSelector", typeof(DateTimePickerPanel))]
[TemplatePart("MinuteUpButton", typeof(RepeatButton))]
[TemplatePart("PeriodDownButton", typeof(RepeatButton))]
[TemplatePart("PeriodHost", typeof(Panel))]
[TemplatePart("PeriodSelector", typeof(DateTimePickerPanel))]
[TemplatePart("PeriodUpButton", typeof(RepeatButton))]
[TemplatePart("PickerContainer", typeof(Grid))]
[TemplatePart("SecondSpacer", typeof(Rectangle))]
public class TimePickerPresenter : PickerPresenterBase public class TimePickerPresenter : PickerPresenterBase
{ {
/// <summary> /// <summary>

2
src/Avalonia.Controls/ListBox.cs

@ -1,5 +1,6 @@
using System.Collections; using System.Collections;
using Avalonia.Controls.Generators; using Avalonia.Controls.Generators;
using Avalonia.Controls.Metadata;
using Avalonia.Controls.Presenters; using Avalonia.Controls.Presenters;
using Avalonia.Controls.Primitives; using Avalonia.Controls.Primitives;
using Avalonia.Controls.Selection; using Avalonia.Controls.Selection;
@ -12,6 +13,7 @@ namespace Avalonia.Controls
/// <summary> /// <summary>
/// An <see cref="ItemsControl"/> in which individual items can be selected. /// An <see cref="ItemsControl"/> in which individual items can be selected.
/// </summary> /// </summary>
[TemplatePart("PART_ScrollViewer", typeof(IScrollable))]
public class ListBox : SelectingItemsControl public class ListBox : SelectingItemsControl
{ {
/// <summary> /// <summary>

1
src/Avalonia.Controls/MenuItem.cs

@ -21,6 +21,7 @@ namespace Avalonia.Controls
/// <summary> /// <summary>
/// A menu item control. /// A menu item control.
/// </summary> /// </summary>
[TemplatePart("PART_Popup", typeof(Popup))]
[PseudoClasses(":separator", ":icon", ":open", ":pressed", ":selected")] [PseudoClasses(":separator", ":icon", ":open", ":pressed", ":selected")]
public class MenuItem : HeaderedSelectingItemsControl, IMenuItem, ISelectable, ICommandSource public class MenuItem : HeaderedSelectingItemsControl, IMenuItem, ISelectable, ICommandSource
{ {

1
src/Avalonia.Controls/Notifications/WindowNotificationManager.cs

@ -14,6 +14,7 @@ namespace Avalonia.Controls.Notifications
/// <summary> /// <summary>
/// An <see cref="INotificationManager"/> that displays notifications in a <see cref="Window"/>. /// An <see cref="INotificationManager"/> that displays notifications in a <see cref="Window"/>.
/// </summary> /// </summary>
[TemplatePart("PART_Items", typeof(Panel))]
[PseudoClasses(":topleft", ":topright", ":bottomleft", ":bottomright")] [PseudoClasses(":topleft", ":topright", ":bottomleft", ":bottomright")]
public class WindowNotificationManager : TemplatedControl, IManagedNotificationManager, ICustomSimpleHitTest public class WindowNotificationManager : TemplatedControl, IManagedNotificationManager, ICustomSimpleHitTest
{ {

3
src/Avalonia.Controls/NumericUpDown/NumericUpDown.cs

@ -2,6 +2,7 @@
using System.Globalization; using System.Globalization;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using Avalonia.Controls.Metadata;
using Avalonia.Controls.Primitives; using Avalonia.Controls.Primitives;
using Avalonia.Data; using Avalonia.Data;
using Avalonia.Input; using Avalonia.Input;
@ -15,6 +16,8 @@ namespace Avalonia.Controls
/// <summary> /// <summary>
/// Control that represents a TextBox with button spinners that allow incrementing and decrementing numeric values. /// Control that represents a TextBox with button spinners that allow incrementing and decrementing numeric values.
/// </summary> /// </summary>
[TemplatePart("PART_Spinner", typeof(Spinner))]
[TemplatePart("PART_TextBox", typeof(TextBox))]
public class NumericUpDown : TemplatedControl public class NumericUpDown : TemplatedControl
{ {
/// <summary> /// <summary>

4
src/Avalonia.Controls/Primitives/ScrollBar.cs

@ -22,6 +22,10 @@ namespace Avalonia.Controls.Primitives
/// <summary> /// <summary>
/// A scrollbar control. /// A scrollbar control.
/// </summary> /// </summary>
[TemplatePart("PART_LineDownButton", typeof(Button))]
[TemplatePart("PART_LineUpButton", typeof(Button))]
[TemplatePart("PART_PageDownButton", typeof(Button))]
[TemplatePart("PART_PageUpButton", typeof(Button))]
[PseudoClasses(":vertical", ":horizontal")] [PseudoClasses(":vertical", ":horizontal")]
public class ScrollBar : RangeBase public class ScrollBar : RangeBase
{ {

1
src/Avalonia.Controls/ProgressBar.cs

@ -9,6 +9,7 @@ namespace Avalonia.Controls
/// <summary> /// <summary>
/// A control used to indicate the progress of an operation. /// A control used to indicate the progress of an operation.
/// </summary> /// </summary>
[TemplatePart("PART_Indicator", typeof(Border))]
[PseudoClasses(":vertical", ":horizontal", ":indeterminate")] [PseudoClasses(":vertical", ":horizontal", ":indeterminate")]
public class ProgressBar : RangeBase public class ProgressBar : RangeBase
{ {

3
src/Avalonia.Controls/ScrollViewer.cs

@ -1,5 +1,6 @@
using System; using System;
using System.Reactive.Linq; using System.Reactive.Linq;
using Avalonia.Controls.Metadata;
using Avalonia.Controls.Presenters; using Avalonia.Controls.Presenters;
using Avalonia.Controls.Primitives; using Avalonia.Controls.Primitives;
using Avalonia.Input; using Avalonia.Input;
@ -10,6 +11,8 @@ namespace Avalonia.Controls
/// <summary> /// <summary>
/// A control scrolls its content if the content is bigger than the space available. /// A control scrolls its content if the content is bigger than the space available.
/// </summary> /// </summary>
[TemplatePart("PART_HorizontalScrollBar", typeof(ScrollBar))]
[TemplatePart("PART_VerticalScrollBar", typeof(ScrollBar))]
public class ScrollViewer : ContentControl, IScrollable, IScrollAnchorProvider public class ScrollViewer : ContentControl, IScrollable, IScrollAnchorProvider
{ {
/// <summary> /// <summary>

3
src/Avalonia.Controls/Slider.cs

@ -40,6 +40,9 @@ namespace Avalonia.Controls
/// <summary> /// <summary>
/// A control that lets the user select from a range of values by moving a Thumb control along a Track. /// A control that lets the user select from a range of values by moving a Thumb control along a Track.
/// </summary> /// </summary>
[TemplatePart("PART_DecreaseButton", typeof(Button))]
[TemplatePart("PART_IncreaseButton", typeof(Button))]
[TemplatePart("PART_Track", typeof(Track))]
[PseudoClasses(":vertical", ":horizontal", ":pressed")] [PseudoClasses(":vertical", ":horizontal", ":pressed")]
public class Slider : RangeBase public class Slider : RangeBase
{ {

1
src/Avalonia.Controls/SplitView.cs

@ -77,6 +77,7 @@ namespace Avalonia.Controls
/// <summary> /// <summary>
/// A control with two views: A collapsible pane and an area for content /// A control with two views: A collapsible pane and an area for content
/// </summary> /// </summary>
[TemplatePart("PART_PaneRoot", typeof(Panel))]
[PseudoClasses(":open", ":closed")] [PseudoClasses(":open", ":closed")]
[PseudoClasses(":compactoverlay", ":compactinline", ":overlay", ":inline")] [PseudoClasses(":compactoverlay", ":compactinline", ":overlay", ":inline")]
[PseudoClasses(":left", ":right")] [PseudoClasses(":left", ":right")]

2
src/Avalonia.Controls/TabControl.cs

@ -9,12 +9,14 @@ using Avalonia.Input;
using Avalonia.Layout; using Avalonia.Layout;
using Avalonia.LogicalTree; using Avalonia.LogicalTree;
using Avalonia.VisualTree; using Avalonia.VisualTree;
using Avalonia.Controls.Metadata;
namespace Avalonia.Controls namespace Avalonia.Controls
{ {
/// <summary> /// <summary>
/// A tab control that displays a tab strip along with the content of the selected tab. /// A tab control that displays a tab strip along with the content of the selected tab.
/// </summary> /// </summary>
[TemplatePart("PART_ItemsPresenter", typeof(ItemsPresenter))]
public class TabControl : SelectingItemsControl, IContentPresenterHost public class TabControl : SelectingItemsControl, IContentPresenterHost
{ {
/// <summary> /// <summary>

1
src/Avalonia.Controls/TextBox.cs

@ -20,6 +20,7 @@ namespace Avalonia.Controls
/// <summary> /// <summary>
/// Represents a control that can be used to display or edit unformatted text. /// Represents a control that can be used to display or edit unformatted text.
/// </summary> /// </summary>
[TemplatePart("PART_TextPresenter", typeof(TextPresenter))]
[PseudoClasses(":empty")] [PseudoClasses(":empty")]
public class TextBox : TemplatedControl, UndoRedoHelper<TextBox.UndoRedoState>.IUndoRedoHost public class TextBox : TemplatedControl, UndoRedoHelper<TextBox.UndoRedoState>.IUndoRedoHost
{ {

2
src/Avalonia.Controls/ToggleSwitch.cs

@ -9,6 +9,8 @@ namespace Avalonia.Controls
/// <summary> /// <summary>
/// A Toggle Switch control. /// A Toggle Switch control.
/// </summary> /// </summary>
[TemplatePart("MovingKnobs", typeof(Panel))]
[TemplatePart("SwitchKnob", typeof(Panel))]
[PseudoClasses(":dragging")] [PseudoClasses(":dragging")]
public class ToggleSwitch : ToggleButton public class ToggleSwitch : ToggleButton
{ {

2
src/Avalonia.Controls/TopLevel.cs

@ -1,5 +1,6 @@
using System; using System;
using System.Reactive.Linq; using System.Reactive.Linq;
using Avalonia.Controls.Metadata;
using Avalonia.Controls.Platform; using Avalonia.Controls.Platform;
using Avalonia.Controls.Primitives; using Avalonia.Controls.Primitives;
using Avalonia.Input; using Avalonia.Input;
@ -26,6 +27,7 @@ namespace Avalonia.Controls
/// It handles scheduling layout, styling and rendering as well as /// It handles scheduling layout, styling and rendering as well as
/// tracking the widget's <see cref="ClientSize"/>. /// tracking the widget's <see cref="ClientSize"/>.
/// </remarks> /// </remarks>
[TemplatePart("PART_TransparencyFallback", typeof(Border))]
public abstract class TopLevel : ContentControl, public abstract class TopLevel : ContentControl,
IInputRoot, IInputRoot,
ILayoutRoot, ILayoutRoot,

1
src/Avalonia.Controls/TreeViewItem.cs

@ -12,6 +12,7 @@ namespace Avalonia.Controls
/// <summary> /// <summary>
/// An item in a <see cref="TreeView"/>. /// An item in a <see cref="TreeView"/>.
/// </summary> /// </summary>
[TemplatePart("PART_Header", typeof(IControl))]
[PseudoClasses(":pressed", ":selected")] [PseudoClasses(":pressed", ":selected")]
public class TreeViewItem : HeaderedItemsControl, ISelectable public class TreeViewItem : HeaderedItemsControl, ISelectable
{ {

Loading…
Cancel
Save