/// FlexAlignmentSelfProperty
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
- public static readonly BindableProperty FlexAlignmentSelfProperty = BindableProperty.CreateAttached("FlexAlignmentSelf", typeof(AlignmentType), typeof(FlexLayout), AlignmentType.Auto, propertyChanged: OnChildPropertyChanged);
+ public static readonly BindableProperty FlexAlignmentSelfProperty = BindableProperty.CreateAttached("FlexAlignmentSelf", typeof(AlignmentType), typeof(FlexLayout), AlignmentType.Auto, validateValue: ValidateEnum((int)AlignmentType.Auto, (int)AlignmentType.Stretch), propertyChanged: OnChildPropertyChanged);
/// <summary>
/// FlexPositionTypeProperty
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
- public static readonly BindableProperty FlexPositionTypeProperty = BindableProperty.CreateAttached("FlexPositionType", typeof(PositionType), typeof(FlexLayout), PositionType.Relative, propertyChanged: OnChildPropertyChanged);
+ public static readonly BindableProperty FlexPositionTypeProperty = BindableProperty.CreateAttached("FlexPositionType", typeof(PositionType), typeof(FlexLayout), PositionType.Relative, validateValue: ValidateEnum((int)PositionType.Relative, (int)PositionType.Absolute), propertyChanged: OnChildPropertyChanged);
/// <summary>
/// AspectRatioProperty
/// Gets/Sets the flex direction in the layout.
/// The direction of the main-axis which determines the direction that flex items are laid out.
/// </summary>
+ /// <exception cref="InvalidEnumArgumentException">Thrown when using invalid arguments that are enumerators.</exception>
/// <since_tizen> 6 </since_tizen>
public FlexDirection Direction
{
get => (FlexDirection)Interop.FlexLayout.FlexLayout_GetFlexDirection(swigCPtr);
set
{
+ if (value < FlexDirection.Column || value > FlexDirection.RowReverse)
+ throw new InvalidEnumArgumentException(nameof(Direction));
+
Interop.FlexLayout.FlexLayout_SetFlexDirection(swigCPtr, (int)value);
RequestLayout();
}
/// For example, you can use this property to center a child horizontally within a container with <see cref="Direction"/> set to <see cref="FlexDirection.Row"/>
/// or vertically within a container with <see cref="Direction"/> set to <see cref="FlexDirection.Column"/>.
/// </summary>
+ /// <exception cref="InvalidEnumArgumentException">Thrown when using invalid arguments that are enumerators.</exception>
/// <since_tizen> 6 </since_tizen>
public FlexJustification Justification
{
get => (FlexJustification)Interop.FlexLayout.FlexLayout_GetFlexJustification(swigCPtr);
set
{
+ if (value < FlexJustification.FlexStart || value > FlexJustification.SpaceAround)
+ throw new InvalidEnumArgumentException(nameof(Justification));
+
Interop.FlexLayout.FlexLayout_SetFlexJustification(swigCPtr, (int)value);
RequestLayout();
}
/// If wrapping is allowed items are wrapped into multiple lines along the main axis if needed. wrap reverse behaves the same, but the order of the lines is reversed.<br/>
/// When wrapping lines <see cref="Alignment"/> can be used to specify how the lines are placed in the container.
/// </summary>
+ /// <exception cref="InvalidEnumArgumentException">Thrown when using invalid arguments that are enumerators.</exception>
/// <since_tizen> 6 </since_tizen>
public FlexWrapType WrapType
{
get => (FlexWrapType)Interop.FlexLayout.FlexLayout_GetFlexWrap(swigCPtr);
set
{
+ if (value != FlexWrapType.NoWrap || value != FlexWrapType.Wrap)
+ throw new InvalidEnumArgumentException(nameof(WrapType));
+
Interop.FlexLayout.FlexLayout_SetFlexWrap(swigCPtr, (int)value);
RequestLayout();
+
}
}
/// Alignment defines the distribution of lines along the cross-axis.<br/>
/// This only has effect when items are wrapped to multiple lines using flex wrap.
/// </summary>
+ /// <exception cref="InvalidEnumArgumentException">Thrown when using invalid arguments that are enumerators.</exception>
/// <since_tizen> 6 </since_tizen>
public AlignmentType Alignment
{
get => GetFlexAlignment();
set
{
+ if (value < AlignmentType.Auto || value > AlignmentType.Stretch)
+ throw new InvalidEnumArgumentException(nameof(Alignment));
+
Interop.FlexLayout.FlexLayout_SetFlexAlignment(swigCPtr, (int)value);
RequestLayout();
}
/// Items alignment describes how to align children along the cross axis of their container.<br/>
/// Align items is very similar to <see cref="Justification"/> but instead of applying to the main axis, align items applies to the cross axis.
/// </summary>
+ /// <exception cref="InvalidEnumArgumentException">Thrown when using invalid arguments that are enumerators.</exception>
/// <since_tizen> 6 </since_tizen>
public AlignmentType ItemsAlignment
{
get => GetFlexItemsAlignment();
set
{
+ if (value < AlignmentType.Auto || value > AlignmentType.Stretch)
+ throw new InvalidEnumArgumentException(nameof(ItemsAlignment));
+
Interop.FlexLayout.FlexLayout_SetFlexItemsAlignment(swigCPtr, (int)value);
RequestLayout();
}
/// HorizontalStretchProperty
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
- public static readonly BindableProperty HorizontalStretchProperty = BindableProperty.CreateAttached("HorizontalStretch", typeof(StretchFlags), typeof(GridLayout), default(StretchFlags), propertyChanged: OnChildPropertyChanged);
+ public static readonly BindableProperty HorizontalStretchProperty = BindableProperty.CreateAttached("HorizontalStretch", typeof(StretchFlags), typeof(GridLayout), default(StretchFlags), validateValue: ValidateEnum((int)StretchFlags.None, (int)StretchFlags.ExpandAndFill), propertyChanged: OnChildPropertyChanged);
/// <summary>
/// VerticalStretchProperty
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
- public static readonly BindableProperty VerticalStretchProperty = BindableProperty.CreateAttached("VerticalStretch", typeof(StretchFlags), typeof(GridLayout), default(StretchFlags), propertyChanged: OnChildPropertyChanged);
+ public static readonly BindableProperty VerticalStretchProperty = BindableProperty.CreateAttached("VerticalStretch", typeof(StretchFlags), typeof(GridLayout), default(StretchFlags), validateValue: ValidateEnum((int)StretchFlags.None, (int)StretchFlags.ExpandAndFill), propertyChanged: OnChildPropertyChanged);
/// <summary>
/// HorizontalAlignmentProperty
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
- public static readonly BindableProperty HorizontalAlignmentProperty = BindableProperty.CreateAttached("HorizontalAlignment", typeof(Alignment), typeof(GridLayout), Alignment.Start, propertyChanged: OnChildPropertyChanged);
+ public static readonly BindableProperty HorizontalAlignmentProperty = BindableProperty.CreateAttached("HorizontalAlignment", typeof(Alignment), typeof(GridLayout), Alignment.Start, validateValue: ValidateEnum((int)Alignment.Start, (int)Alignment.End), propertyChanged: OnChildPropertyChanged);
/// <summary>
/// VerticalAlignmentProperty
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
- public static readonly BindableProperty VerticalAlignmentProperty = BindableProperty.CreateAttached("VerticalAlignment", typeof(Alignment), typeof(GridLayout), Alignment.Start, propertyChanged: OnChildPropertyChanged);
+ public static readonly BindableProperty VerticalAlignmentProperty = BindableProperty.CreateAttached("VerticalAlignment", typeof(Alignment), typeof(GridLayout), Alignment.Start, validateValue: ValidateEnum((int)Alignment.Start, (int)Alignment.End), propertyChanged: OnChildPropertyChanged);
private const int CellUndefined = int.MinValue;
private Orientation gridOrientation = Orientation.Horizontal;
/// <summary>
/// Get/Set the orientation in the layout
/// </summary>
+ /// <exception cref="InvalidEnumArgumentException">Thrown when using invalid arguments that are enumerators.</exception>
/// <since_tizen> 8 </since_tizen>
public Orientation GridOrientation
{
set
{
if (gridOrientation == value) return;
+ if (value != Orientation.Horizontal || value != Orientation.Vertical)
+ throw new InvalidEnumArgumentException(nameof(GridOrientation));
+
gridOrientation = value;
RequestLayout();
}