2 * Copyright(c) 2020 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 using System.Collections.Generic;
19 using System.ComponentModel;
20 using Tizen.NUI.Binding;
22 namespace Tizen.NUI.BaseComponents
25 /// The base class for Children attributes in Components.
27 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
28 [EditorBrowsable(EditorBrowsableState.Never)]
29 public partial class ViewStyle : BindableObject
31 private string styleName;
32 private View.States? state;
33 private View.States? subState;
35 private int? alignSelf;
36 private Vector4 flexMargin;
37 private Vector2 cellIndex;
38 private float? rowSpan;
39 private float? columnSpan;
40 private HorizontalAlignmentType? cellHorizontalAlignment;
41 private VerticalAlignmentType? cellVerticalAlignment;
42 private View leftFocusableView;
43 private View rightFocusableView;
44 private View upFocusableView;
45 private View downFocusableView;
46 private bool? focusable;
47 private bool? positionUsesPivotPoint;
48 private int? siblingOrder;
49 private Position parentOrigin;
50 private Position pivotPoint;
51 private Position position;
52 private Rotation orientation;
53 private Vector3 scale;
55 private bool? sensitive;
56 private bool? leaveRequired;
57 private bool? inheritOrientation;
58 private bool? inheritScale;
59 private DrawModeType? drawMode;
60 private Vector3 sizeModeFactor;
61 private ResizePolicyType? widthResizePolicy;
62 private ResizePolicyType? heightResizePolicy;
63 private SizeScalePolicyType? sizeScalePolicy;
64 private bool? widthForHeight;
65 private bool? heightForWidth;
66 private Extents padding;
67 private Size2D minimumSize;
68 private Size2D maximumSize;
69 private bool? inheritPosition;
70 private ClippingModeType? clippingMode;
72 private bool? inheritLayoutDirection;
73 private ViewLayoutDirectionType? layoutDirection;
74 private Extents margin;
75 private float? weight;
76 private bool? enableControlState;
77 private bool? themeChangeSensitive;
79 private Selector<ImageShadow> imageShadow;
80 private Selector<Shadow> boxShadow;
81 private Selector<string> backgroundImageSelector;
82 private Selector<float?> cornerRadius;
83 private Selector<float?> opacitySelector;
84 private Selector<Color> backgroundColorSelector;
85 private Selector<Rectangle> backgroundImageBorderSelector;
86 private Selector<Color> colorSelector;
87 private VisualTransformPolicyType? cornerRadiusPolicy;
89 static ViewStyle() { }
91 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
92 [EditorBrowsable(EditorBrowsableState.Never)]
93 public ViewStyle() { }
95 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
96 [EditorBrowsable(EditorBrowsableState.Never)]
97 public ViewStyle(ViewStyle viewAttributes)
99 CopyFrom(viewAttributes);
103 /// Create an instance and set properties from the given view.
105 /// <param name="view">The View that includes property data.</param>
106 [EditorBrowsable(EditorBrowsableState.Never)]
107 public ViewStyle(View view)
109 CopyPropertiesFromView(view);
112 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
113 [EditorBrowsable(EditorBrowsableState.Never)]
114 public string StyleName
116 get => (string)GetValue(StyleNameProperty);
117 set => SetValue(StyleNameProperty, value);
120 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
121 [EditorBrowsable(EditorBrowsableState.Never)]
122 public Selector<string> BackgroundImage
126 Selector<string> image = (Selector<string>)GetValue(BackgroundImageSelectorProperty);
127 return (null != image) ? image : backgroundImageSelector = new Selector<string>();
129 set => SetValue(BackgroundImageSelectorProperty, value);
132 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
133 [EditorBrowsable(EditorBrowsableState.Never)]
134 public View.States? State
136 get => (View.States?)GetValue(StateProperty);
137 set => SetValue(StateProperty, value);
140 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
141 [EditorBrowsable(EditorBrowsableState.Never)]
142 public View.States? SubState
144 get => (View.States?)GetValue(SubStateProperty);
145 set => SetValue(SubStateProperty, value);
148 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
149 [EditorBrowsable(EditorBrowsableState.Never)]
152 get => (float?)GetValue(FlexProperty);
153 set => SetValue(FlexProperty, value);
156 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
157 [EditorBrowsable(EditorBrowsableState.Never)]
158 public int? AlignSelf
160 get => (int?)GetValue(AlignSelfProperty);
161 set => SetValue(AlignSelfProperty, value);
164 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
165 [EditorBrowsable(EditorBrowsableState.Never)]
166 public Vector4 FlexMargin
168 get => (Vector4)GetValue(FlexMarginProperty);
169 set => SetValue(FlexMarginProperty, value);
172 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
173 [EditorBrowsable(EditorBrowsableState.Never)]
174 public Vector2 CellIndex
176 get => (Vector2)GetValue(CellIndexProperty);
177 set => SetValue(CellIndexProperty, value);
180 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
181 [EditorBrowsable(EditorBrowsableState.Never)]
182 public float? RowSpan
184 get => (float?)GetValue(RowSpanProperty);
185 set => SetValue(RowSpanProperty, value);
188 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
189 [EditorBrowsable(EditorBrowsableState.Never)]
190 public float? ColumnSpan
192 get => (float?)GetValue(ColumnSpanProperty);
193 set => SetValue(ColumnSpanProperty, value);
196 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
197 [EditorBrowsable(EditorBrowsableState.Never)]
198 public HorizontalAlignmentType? CellHorizontalAlignment
200 get => (HorizontalAlignmentType?)GetValue(CellHorizontalAlignmentProperty);
201 set => SetValue(CellHorizontalAlignmentProperty, value);
204 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
205 [EditorBrowsable(EditorBrowsableState.Never)]
206 public VerticalAlignmentType? CellVerticalAlignment
208 get => (VerticalAlignmentType?)GetValue(CellVerticalAlignmentProperty);
209 set => SetValue(CellVerticalAlignmentProperty, value);
212 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
213 [EditorBrowsable(EditorBrowsableState.Never)]
214 public View LeftFocusableView
216 get => (View)GetValue(LeftFocusableViewProperty);
217 set => SetValue(LeftFocusableViewProperty, value);
220 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
221 [EditorBrowsable(EditorBrowsableState.Never)]
222 public View RightFocusableView
224 get => (View)GetValue(RightFocusableViewProperty);
225 set => SetValue(RightFocusableViewProperty, value);
228 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
229 [EditorBrowsable(EditorBrowsableState.Never)]
230 public View UpFocusableView
232 get => (View)GetValue(UpFocusableViewProperty);
233 set => SetValue(UpFocusableViewProperty, value);
236 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
237 [EditorBrowsable(EditorBrowsableState.Never)]
238 public View DownFocusableView
240 get => (View)GetValue(DownFocusableViewProperty);
241 set => SetValue(DownFocusableViewProperty, value);
244 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
245 [EditorBrowsable(EditorBrowsableState.Never)]
246 public bool? Focusable
248 get => (bool?)GetValue(FocusableProperty);
249 set => SetValue(FocusableProperty, value);
252 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
253 [EditorBrowsable(EditorBrowsableState.Never)]
256 get => (Size2D)GetValue(Size2DProperty);
257 set => SetValue(Size2DProperty, value);
260 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
261 [EditorBrowsable(EditorBrowsableState.Never)]
262 public Selector<float?> Opacity
266 Selector<float?> opacity = (Selector<float?>)GetValue(OpacitySelectorProperty);
267 return (null != opacity) ? opacity : opacitySelector = new Selector<float?>();
269 set => SetValue(OpacitySelectorProperty, value);
272 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
273 [EditorBrowsable(EditorBrowsableState.Never)]
274 public Position2D Position2D
276 get => (Position2D)GetValue(Position2DProperty);
277 set => SetValue(Position2DProperty, value);
280 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
281 [EditorBrowsable(EditorBrowsableState.Never)]
282 public bool? PositionUsesPivotPoint
284 get => (bool?)GetValue(PositionUsesPivotPointProperty);
285 set => SetValue(PositionUsesPivotPointProperty, value);
288 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
289 [EditorBrowsable(EditorBrowsableState.Never)]
290 public int? SiblingOrder
292 get => (int?)GetValue(SiblingOrderProperty);
293 set => SetValue(SiblingOrderProperty, value);
296 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
297 [EditorBrowsable(EditorBrowsableState.Never)]
298 public Position ParentOrigin
300 get => (Position)GetValue(ParentOriginProperty);
301 set => SetValue(ParentOriginProperty, value);
304 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
305 [EditorBrowsable(EditorBrowsableState.Never)]
306 public Position PivotPoint
308 get => (Position)GetValue(PivotPointProperty);
309 set => SetValue(PivotPointProperty, value);
312 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
313 [EditorBrowsable(EditorBrowsableState.Never)]
314 public float? SizeWidth
316 get => (float?)GetValue(SizeWidthProperty);
317 set => SetValue(SizeWidthProperty, value);
320 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
321 [EditorBrowsable(EditorBrowsableState.Never)]
322 public float? SizeHeight
324 get => (float?)GetValue(SizeHeightProperty);
325 set => SetValue(SizeHeightProperty, value);
328 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
329 [EditorBrowsable(EditorBrowsableState.Never)]
330 public Position Position
332 get => (Position)GetValue(PositionProperty);
333 set => SetValue(PositionProperty, value);
336 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
337 [EditorBrowsable(EditorBrowsableState.Never)]
338 public float? PositionX
340 get => (float?)GetValue(PositionXProperty);
341 set => SetValue(PositionXProperty, value);
344 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
345 [EditorBrowsable(EditorBrowsableState.Never)]
346 public float? PositionY
348 get => (float?)GetValue(PositionYProperty);
349 set => SetValue(PositionYProperty, value);
352 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
353 [EditorBrowsable(EditorBrowsableState.Never)]
354 public float? PositionZ
356 get => (float?)GetValue(PositionZProperty);
357 set => SetValue(PositionZProperty, value);
360 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
361 [EditorBrowsable(EditorBrowsableState.Never)]
362 public Rotation Orientation
364 get => (Rotation)GetValue(OrientationProperty);
365 set => SetValue(OrientationProperty, value);
368 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
369 [EditorBrowsable(EditorBrowsableState.Never)]
372 get => (Vector3)GetValue(ScaleProperty);
373 set => SetValue(ScaleProperty, value);
376 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
377 [EditorBrowsable(EditorBrowsableState.Never)]
380 get => (float?)GetValue(ScaleXProperty);
381 set => SetValue(ScaleXProperty, value);
384 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
385 [EditorBrowsable(EditorBrowsableState.Never)]
388 get => (float?)GetValue(ScaleYProperty);
389 set => SetValue(ScaleYProperty, value);
392 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
393 [EditorBrowsable(EditorBrowsableState.Never)]
396 get => (float?)GetValue(ScaleZProperty);
397 set => SetValue(ScaleZProperty, value);
400 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
401 [EditorBrowsable(EditorBrowsableState.Never)]
404 get => (string)GetValue(NameProperty);
405 set => SetValue(NameProperty, value);
408 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
409 [EditorBrowsable(EditorBrowsableState.Never)]
410 public bool? Sensitive
412 get => (bool?)GetValue(SensitiveProperty);
413 set => SetValue(SensitiveProperty, value);
416 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
417 [EditorBrowsable(EditorBrowsableState.Never)]
418 public bool? LeaveRequired
420 get => (bool?)GetValue(LeaveRequiredProperty);
421 set => SetValue(LeaveRequiredProperty, value);
424 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
425 [EditorBrowsable(EditorBrowsableState.Never)]
426 public bool? InheritOrientation
428 get => (bool?)GetValue(InheritOrientationProperty);
429 set => SetValue(InheritOrientationProperty, value);
432 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
433 [EditorBrowsable(EditorBrowsableState.Never)]
434 public bool? InheritScale
436 get => (bool?)GetValue(InheritScaleProperty);
437 set => SetValue(InheritScaleProperty, value);
440 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
441 [EditorBrowsable(EditorBrowsableState.Never)]
442 public DrawModeType? DrawMode
444 get => (DrawModeType?)GetValue(DrawModeProperty);
445 set => SetValue(DrawModeProperty, value);
448 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
449 [EditorBrowsable(EditorBrowsableState.Never)]
450 public Vector3 SizeModeFactor
452 get => (Vector3)GetValue(SizeModeFactorProperty);
453 set => SetValue(SizeModeFactorProperty, value);
456 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
457 [EditorBrowsable(EditorBrowsableState.Never)]
458 public ResizePolicyType? WidthResizePolicy
460 get => (ResizePolicyType?)GetValue(WidthResizePolicyProperty);
461 set => SetValue(WidthResizePolicyProperty, value);
464 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
465 [EditorBrowsable(EditorBrowsableState.Never)]
466 public ResizePolicyType? HeightResizePolicy
468 get => (ResizePolicyType?)GetValue(HeightResizePolicyProperty);
469 set => SetValue(HeightResizePolicyProperty, value);
472 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
473 [EditorBrowsable(EditorBrowsableState.Never)]
474 public SizeScalePolicyType? SizeScalePolicy
476 get => (SizeScalePolicyType?)GetValue(SizeScalePolicyProperty);
477 set => SetValue(SizeScalePolicyProperty, value);
480 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
481 [EditorBrowsable(EditorBrowsableState.Never)]
482 public bool? WidthForHeight
484 get => (bool?)GetValue(WidthForHeightProperty);
485 set => SetValue(WidthForHeightProperty, value);
488 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
489 [EditorBrowsable(EditorBrowsableState.Never)]
490 public bool? HeightForWidth
492 get => (bool?)GetValue(HeightForWidthProperty);
493 set => SetValue(HeightForWidthProperty, value);
496 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
497 [EditorBrowsable(EditorBrowsableState.Never)]
498 public Extents Padding
502 Extents tmp = (Extents)GetValue(PaddingProperty);
503 return (null != tmp) ? tmp : padding = new Extents(OnPaddingChanged, 0, 0, 0, 0);
505 set => SetValue(PaddingProperty, value);
508 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
509 [EditorBrowsable(EditorBrowsableState.Never)]
510 public Size2D MinimumSize
512 get => (Size2D)GetValue(MinimumSizeProperty);
513 set => SetValue(MinimumSizeProperty, value);
516 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
517 [EditorBrowsable(EditorBrowsableState.Never)]
518 public Size2D MaximumSize
520 get => (Size2D)GetValue(MaximumSizeProperty);
521 set => SetValue(MaximumSizeProperty, value);
524 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
525 [EditorBrowsable(EditorBrowsableState.Never)]
526 public bool? InheritPosition
528 get => (bool?)GetValue(InheritPositionProperty);
529 set => SetValue(InheritPositionProperty, value);
532 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
533 [EditorBrowsable(EditorBrowsableState.Never)]
534 public ClippingModeType? ClippingMode
536 get => (ClippingModeType?)GetValue(ClippingModeProperty);
537 set => SetValue(ClippingModeProperty, value);
540 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
541 [EditorBrowsable(EditorBrowsableState.Never)]
546 Size tmp = (Size)GetValue(SizeProperty);
547 return (null != tmp) ? tmp : size = new Size((float? width, float? height, float? depth) =>
549 float targetWidth = 0;
550 float targetHeight = 0;
551 float targetDepth = 0;
555 targetWidth = size.Width;
556 targetHeight = size.Height;
557 targetDepth = size.Depth;
559 if (width != null) { targetWidth = (float)width; }
560 if (height != null) { targetHeight = (float)height; }
561 if (depth != null) { targetDepth = (float)depth; }
563 Size = new Size(targetWidth, targetHeight, targetDepth);
566 set => SetValue(SizeProperty, value);
569 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
570 [EditorBrowsable(EditorBrowsableState.Never)]
571 public bool? InheritLayoutDirection
573 get => (bool?)GetValue(InheritLayoutDirectionProperty);
574 set => SetValue(InheritLayoutDirectionProperty, value);
577 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
578 [EditorBrowsable(EditorBrowsableState.Never)]
579 public ViewLayoutDirectionType? LayoutDirection
581 get => (ViewLayoutDirectionType?)GetValue(LayoutDirectionProperty);
582 set => SetValue(LayoutDirectionProperty, value);
585 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
586 [EditorBrowsable(EditorBrowsableState.Never)]
587 public Extents Margin
591 Extents tmp = (Extents)GetValue(MarginProperty);
592 return (null != tmp) ? tmp : margin = new Extents(OnMarginChanged, 0, 0, 0, 0);
594 set => SetValue(MarginProperty, value);
597 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
598 [EditorBrowsable(EditorBrowsableState.Never)]
601 get => (float?)GetValue(WeightProperty);
602 set => SetValue(WeightProperty, value);
605 /// <summary> View BackgroundColor </summary>
606 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
607 [EditorBrowsable(EditorBrowsableState.Never)]
608 public Selector<Color> BackgroundColor
612 Selector<Color> color = (Selector<Color>)GetValue(BackgroundColorSelectorProperty);
613 return (null != color) ? color : backgroundColorSelector = new Selector<Color>();
615 set => SetValue(BackgroundColorSelectorProperty, value);
621 [EditorBrowsable(EditorBrowsableState.Never)]
622 public Selector<Color> Color
626 Selector<Color> color = (Selector<Color>)GetValue(ColorSelectorProperty);
627 return (null != color) ? color : colorSelector = new Selector<Color>();
629 set => SetValue(ColorSelectorProperty, value);
632 /// <summary>View BackgroundBorder</summary>
633 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
634 [EditorBrowsable(EditorBrowsableState.Never)]
635 public Selector<Rectangle> BackgroundImageBorder
639 Selector<Rectangle> border = (Selector<Rectangle>)GetValue(BackgroundImageBorderSelectorProperty);
640 return (null != border) ? border : backgroundImageBorderSelector = new Selector<Rectangle>();
642 set => SetValue(BackgroundImageBorderSelectorProperty, value);
646 /// Describes a shadow as an image for a View.
647 /// It is null by default.
650 /// If BoxShadow is not null, the ImageShadow value will be ignored.
652 [EditorBrowsable(EditorBrowsableState.Never)]
653 public Selector<ImageShadow> ImageShadow
655 get => (Selector<ImageShadow>)GetValue(ImageShadowSelectorProperty);
656 set => SetValue(ImageShadowSelectorProperty, value);
660 /// Describes a box shaped shadow drawing for a View.
661 /// It is null by default.
663 [EditorBrowsable(EditorBrowsableState.Never)]
664 public Selector<Shadow> BoxShadow
666 get => (Selector<Shadow>)GetValue(BoxShadowSelectorProperty);
667 set => SetValue(BoxShadowSelectorProperty, value);
671 /// The radius for the rounded corners of the View
673 [EditorBrowsable(EditorBrowsableState.Never)]
674 public Selector<float?> CornerRadius
676 get => (Selector<float?>)GetValue(CornerRadiusProperty);
677 set => SetValue(CornerRadiusProperty, value);
681 /// Whether the CornerRadius property value is relative (percentage [0.0f to 1.0f] of the view size) or absolute (in world units).
682 /// It is absolute by default.
683 /// When the policy is relative, the corner radius is relative to the smaller of the view's width and height.
685 [EditorBrowsable(EditorBrowsableState.Never)]
686 public VisualTransformPolicyType? CornerRadiusPolicy
688 get => (VisualTransformPolicyType?)GetValue(CornerRadiusPolicyProperty);
689 set => SetValue(CornerRadiusPolicyProperty, value);
693 /// The EnableControlState value of the View.
695 [EditorBrowsable(EditorBrowsableState.Never)]
696 public bool? EnableControlState
698 get => (bool?)GetValue(EnableControlStateProperty);
699 set => SetValue(EnableControlStateProperty, value);
703 /// The ThemeChangeSensitive value of the View.
705 [EditorBrowsable(EditorBrowsableState.Never)]
706 public bool? ThemeChangeSensitive
708 get => (bool?)GetValue(ThemeChangeSensitiveProperty);
709 set => SetValue(ThemeChangeSensitiveProperty, value);
714 /// Allow null properties when merging it into other Theme.
715 /// If the value is true, the null properties reset target properties of the other ViewStyle with same key when merge.
716 /// It is used in <seealso cref="Theme.Merge(string)"/>, <seealso cref="Theme.Merge(Theme)"/>.
717 /// It is also used in <seealso cref="Theme.GetStyle(string)"/> when the Theme has a parent and needs to merge.
718 /// Please note that it is false by default.
720 [EditorBrowsable(EditorBrowsableState.Never)]
721 public bool SolidNull { get; set; } = false;
724 /// Set style's bindable properties from the view.
726 /// <param name="view">The view that includes property data.</param>
727 [EditorBrowsable(EditorBrowsableState.Never)]
728 public virtual void CopyPropertiesFromView(View view)
730 if (view == null) return;
732 BindableProperty.GetBindablePropertysOfType(GetType(), out var styleProperties);
733 BindableProperty.GetBindablePropertysOfType(view.GetType(), out var viewProperties);
736 if (styleProperties == null || viewProperties == null) return;
738 foreach (var stylePropertyItem in styleProperties)
740 viewProperties.TryGetValue(stylePropertyItem.Key, out var viewProperty);
742 if (viewProperty == null) continue;
744 SetValue(stylePropertyItem.Value, view.GetValue(viewProperty));
748 /// <summary>Create a cloned ViewStyle.</summary>
749 [EditorBrowsable(EditorBrowsableState.Never)]
750 public ViewStyle Clone()
752 var cloned = CreateInstance();
753 cloned.CopyFrom(this);
758 /// <summary>Create a cloned ViewStyle.</summary>
759 [EditorBrowsable(EditorBrowsableState.Never)]
760 public void Merge(ViewStyle other)
762 AllowNullCopy = other?.SolidNull ?? false;
764 AllowNullCopy = false;
767 internal ViewStyle CreateInstance()
769 return (ViewStyle)Activator.CreateInstance(GetType());
772 private void OnPaddingChanged(ushort start, ushort end, ushort top, ushort bottom)
774 Padding = new Extents(start, end, top, bottom);
777 private void OnMarginChanged(ushort start, ushort end, ushort top, ushort bottom)
779 Margin = new Extents(start, end, top, bottom);