IndentConverter Class
Definition
Converts an integer indentation level to a Avalonia.Thickness value for use in hierarchical data displays.
public class IndentConverter
Remarks
IndentConverter is primarily used in the TreeDataGrid control to create appropriate left margin indentation for hierarchical data. It multiplies the input indent level by 20 device-independent pixels to create a left margin, resulting in a visual tree structure.
This converter is typically used in templates for Avalonia.Controls.Primitives.TreeDataGridExpanderCell or other controls that display hierarchical data where rows need different levels of indentation based on their depth in the hierarchy.
Example usage in XAML:
<Border Margin="{Binding Indent, Converter={x:Static converters:IndentConverter.Instance}}"/>
Constructors
| Name | Description |
|---|---|
| IndentConverter | No summary available. |
IndentConverter Constructor
public IndentConverter()
Methods
| Name | Description |
|---|---|
| Convert | Converts an integer indent value to a Avalonia.Thickness with the appropriate left margin. |
| ConvertBack | Converts a thickness back to an integer indent value. |
Convert Method
Converts an integer indent value to a Avalonia.Thickness with the appropriate left margin.
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
Parameters
value object
An integer representing the indentation level.
targetType Type
The type of the binding target property.
parameter object
Optional parameter (not used).
culture System.Globalization.CultureInfo
Culture information (not used).
Returns
object
A Avalonia.Thickness where the left value is set to 20 * indent and other values are 0. Returns an empty Avalonia.Thickness if value is not an integer.
ConvertBack Method
Converts a thickness back to an integer indent value.
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
Parameters
value object
The thickness to convert back.
targetType Type
The type of the binding target property.
parameter object
Optional parameter (not used).
culture System.Globalization.CultureInfo
Culture information (not used).
Returns
object
This operation is not supported and will throw NotImplementedException.
Exceptions
Properties
| Name | Description |
|---|---|
| Instance | Gets a shared instance of the Avalonia.Controls.Converters.IndentConverter. |
Instance Property
Gets a shared instance of the Avalonia.Controls.Converters.IndentConverter.
public Avalonia.Controls.Converters.IndentConverter Instance { get; set; }