Design Class
Definition
Provides attached properties and helpers for design-time support.
public class Design
Methods
| Name | Description |
|---|---|
| GetDataContext (2 overloads) | Gets the design-time data context for a control. |
| GetDesignStyle | Gets the design-time style for a control. |
| GetHeight | Gets the design-time height for a control. |
| GetPreviewWith (4 overloads) | Gets the preview control for the specified Avalonia.AvaloniaObject at design-time. |
| GetWidth | Gets the design-time width for a control. |
| SetDataContext (2 overloads) | Sets the design-time data context for a control. |
| SetDesignStyle | Sets the design-time style for a control. |
| SetHeight | Sets the design-time height for a control. |
| SetPreviewWith (7 overloads) | No summary available. |
| SetWidth | Sets the design-time width for a control. |
GetDataContext overloads
GetDataContext Method
Gets the design-time data context for a control.
public object GetDataContext(Avalonia.Controls.Control control)
Parameters
control Avalonia.Controls.Control
The control to get the data context from.
Returns
object
The data context value.
GetDataContext Method
Gets the design-time data context for a control.
public object GetDataContext(Avalonia.Controls.Templates.IDataTemplate control)
Parameters
control Avalonia.Controls.Templates.IDataTemplate
The control to get the data context from.
Returns
object
The data context value.
GetDesignStyle Method
Gets the design-time style for a control.
public Avalonia.Styling.IStyle GetDesignStyle(Avalonia.Controls.Control control)
Parameters
control Avalonia.Controls.Control
The control to get the style from.
Returns
The style value.
GetHeight Method
Gets the design-time height for a control.
public double GetHeight(Avalonia.Controls.Control control)
Parameters
control Avalonia.Controls.Control
The control to get the height from.
Returns
double
The height value.
GetPreviewWith overloads
GetPreviewWith Method
Gets the preview control for the specified Avalonia.AvaloniaObject at design-time.
public Avalonia.Controls.Control GetPreviewWith(Avalonia.AvaloniaObject target)
Parameters
target Avalonia.AvaloniaObject
The target object.
Returns
The preview control, or null.
GetPreviewWith Method
Gets the preview control for the specified Avalonia.Controls.ResourceDictionary at design-time.
public Avalonia.Controls.Control GetPreviewWith(Avalonia.Controls.ResourceDictionary target)
Parameters
target Avalonia.Controls.ResourceDictionary
The resource dictionary.
Returns
The preview control, or null.
GetPreviewWith Method
Gets the preview control for the specified Avalonia.Controls.Templates.IDataTemplate at design-time.
public Avalonia.Controls.Control GetPreviewWith(Avalonia.Controls.Templates.IDataTemplate target)
Parameters
target Avalonia.Controls.Templates.IDataTemplate
The data template.
Returns
The preview control, or null.
GetPreviewWith Method
Gets the preview control for the specified Avalonia.Styling.IStyle at design-time.
public Avalonia.Controls.Control GetPreviewWith(Avalonia.Styling.IStyle target)
Parameters
target Avalonia.Styling.IStyle
The style.
Returns
The preview control, or null.
GetWidth Method
Gets the design-time width for a control.
public double GetWidth(Avalonia.Controls.Control control)
Parameters
control Avalonia.Controls.Control
The control to get the width from.
Returns
double
The width value.
SetDataContext overloads
SetDataContext Method
Sets the design-time data context for a control.
public void SetDataContext(Avalonia.Controls.Control control, object value)
Parameters
control Avalonia.Controls.Control
The control to set the data context for.
value object
The data context value.
SetDataContext Method
Sets the design-time data context for a control.
public void SetDataContext(Avalonia.Controls.Templates.IDataTemplate control, object value)
Parameters
control Avalonia.Controls.Templates.IDataTemplate
The control to set the data context for.
value object
The data context value.
SetDesignStyle Method
Sets the design-time style for a control.
public void SetDesignStyle(Avalonia.Controls.Control control, Avalonia.Styling.IStyle value)
Parameters
control Avalonia.Controls.Control
The control to set the style for.
value Avalonia.Styling.IStyle
The style value.
SetHeight Method
Sets the design-time height for a control.
public void SetHeight(Avalonia.Controls.Control control, double value)
Parameters
control Avalonia.Controls.Control
The control to set the height for.
value double
The height value.
SetPreviewWith overloads
SetPreviewWith Method
public void SetPreviewWith(Avalonia.AvaloniaObject target, Avalonia.Controls.ITemplate<TControl><Avalonia.Controls.Control> template)
Parameters
target Avalonia.AvaloniaObject
template Avalonia.Controls.ITemplate<TControl><Avalonia.Controls.Control>
SetPreviewWith Method
Sets a preview template for the specified Avalonia.Controls.ResourceDictionary at design-time.
public void SetPreviewWith(Avalonia.Controls.ResourceDictionary target, Avalonia.Controls.Control control)
Parameters
target Avalonia.Controls.ResourceDictionary
The resource dictionary.
control Avalonia.Controls.Control
The preview control.
Remarks
This method allows you to specify a substitute control to be rendered in the previewer. ResourceDictionary is attached to that control, displaying real time changes on the control.
SetPreviewWith Method
public void SetPreviewWith(Avalonia.Controls.ResourceDictionary target, Avalonia.Controls.ITemplate<TControl><Avalonia.Controls.Control> template)
Parameters
target Avalonia.Controls.ResourceDictionary
template Avalonia.Controls.ITemplate<TControl><Avalonia.Controls.Control>
SetPreviewWith Method
Sets a preview template for the specified Avalonia.Controls.Templates.IDataTemplate at design-time.
public void SetPreviewWith(Avalonia.Controls.Templates.IDataTemplate target, Avalonia.Controls.Control control)
Parameters
target Avalonia.Controls.Templates.IDataTemplate
The data template.
control Avalonia.Controls.Control
The preview control.
Remarks
This method allows you to specify a substitute control to be rendered in the previewer. Template must return ContentControl, and IDataTemplate will be set assigned to ContentControl.ContentTemplate property.
SetPreviewWith Method
public void SetPreviewWith(Avalonia.Controls.Templates.IDataTemplate target, Avalonia.Controls.ITemplate<TControl><Avalonia.Controls.Control> template)
Parameters
target Avalonia.Controls.Templates.IDataTemplate
template Avalonia.Controls.ITemplate<TControl><Avalonia.Controls.Control>
SetPreviewWith Method
Sets a preview template for the specified Avalonia.Controls.Templates.IDataTemplate at design-time.
public void SetPreviewWith(Avalonia.Styling.IStyle target, Avalonia.Controls.Control control)
Parameters
target Avalonia.Styling.IStyle
The data template.
control Avalonia.Controls.Control
The preview control.
Remarks
This method allows you to specify a substitute control to be rendered in the previewer. Template must return ContentControl, and IDataTemplate will be set assigned to ContentControl.ContentTemplate property.
SetPreviewWith Method
public void SetPreviewWith(Avalonia.Styling.IStyle target, Avalonia.Controls.ITemplate<TControl><Avalonia.Controls.Control> template)
Parameters
target Avalonia.Styling.IStyle
template Avalonia.Controls.ITemplate<TControl><Avalonia.Controls.Control>
SetWidth Method
Sets the design-time width for a control.
public void SetWidth(Avalonia.Controls.Control control, double value)
Parameters
control Avalonia.Controls.Control
The control to set the width for.
value double
The width value.
Properties
| Name | Description |
|---|---|
| IsDesignMode | Gets a value indicating whether the application is running in design mode. |
IsDesignMode Property
Gets a value indicating whether the application is running in design mode.
public bool IsDesignMode { get; set; }
Remarks
This property is typically used to enable or disable features that should only be available at design-time, such as sample/preview data.
Fields
| Name | Description |
|---|---|
| DataContextProperty | Defines the DataContext attached property. |
| DesignStyleProperty | Identifies the DesignStyle attached property for design-time use. |
| HeightProperty | Defines the Height attached property. |
| PreviewWithProperty | Defines the PreviewWith attached property. |
| WidthProperty | Defines the Width attached property. |
DataContextProperty Field
Defines the DataContext attached property.
public Avalonia.AttachedProperty<object> DataContextProperty
DesignStyleProperty Field
Identifies the DesignStyle attached property for design-time use.
public Avalonia.AttachedProperty<Avalonia.Styling.IStyle> DesignStyleProperty
Remarks
This property allows you to apply a style to a control only at design-time, enabling custom visualizations or highlighting in the designer without affecting the runtime appearance.
HeightProperty Field
Defines the Height attached property.
public Avalonia.AttachedProperty<double> HeightProperty
PreviewWithProperty Field
Defines the PreviewWith attached property.
public Avalonia.AttachedProperty<Avalonia.Controls.Control> PreviewWithProperty
WidthProperty Field
Defines the Width attached property.
public Avalonia.AttachedProperty<double> WidthProperty