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);
102 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
103 [EditorBrowsable(EditorBrowsableState.Never)]
104 public string StyleName
106 get => (string)GetValue(StyleNameProperty);
107 set => SetValue(StyleNameProperty, value);
110 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
111 [EditorBrowsable(EditorBrowsableState.Never)]
112 public Selector<string> BackgroundImage
116 Selector<string> image = (Selector<string>)GetValue(BackgroundImageSelectorProperty);
117 return (null != image) ? image : backgroundImageSelector = new Selector<string>();
119 set => SetValue(BackgroundImageSelectorProperty, value);
122 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
123 [EditorBrowsable(EditorBrowsableState.Never)]
124 public View.States? State
126 get => (View.States?)GetValue(StateProperty);
127 set => SetValue(StateProperty, value);
130 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
131 [EditorBrowsable(EditorBrowsableState.Never)]
132 public View.States? SubState
134 get => (View.States?)GetValue(SubStateProperty);
135 set => SetValue(SubStateProperty, value);
138 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
139 [EditorBrowsable(EditorBrowsableState.Never)]
142 get => (float?)GetValue(FlexProperty);
143 set => SetValue(FlexProperty, value);
146 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
147 [EditorBrowsable(EditorBrowsableState.Never)]
148 public int? AlignSelf
150 get => (int?)GetValue(AlignSelfProperty);
151 set => SetValue(AlignSelfProperty, value);
154 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
155 [EditorBrowsable(EditorBrowsableState.Never)]
156 public Vector4 FlexMargin
158 get => (Vector4)GetValue(FlexMarginProperty);
159 set => SetValue(FlexMarginProperty, value);
162 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
163 [EditorBrowsable(EditorBrowsableState.Never)]
164 public Vector2 CellIndex
166 get => (Vector2)GetValue(CellIndexProperty);
167 set => SetValue(CellIndexProperty, value);
170 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
171 [EditorBrowsable(EditorBrowsableState.Never)]
172 public float? RowSpan
174 get => (float?)GetValue(RowSpanProperty);
175 set => SetValue(RowSpanProperty, value);
178 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
179 [EditorBrowsable(EditorBrowsableState.Never)]
180 public float? ColumnSpan
182 get => (float?)GetValue(ColumnSpanProperty);
183 set => SetValue(ColumnSpanProperty, value);
186 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
187 [EditorBrowsable(EditorBrowsableState.Never)]
188 public HorizontalAlignmentType? CellHorizontalAlignment
190 get => (HorizontalAlignmentType?)GetValue(CellHorizontalAlignmentProperty);
191 set => SetValue(CellHorizontalAlignmentProperty, value);
194 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
195 [EditorBrowsable(EditorBrowsableState.Never)]
196 public VerticalAlignmentType? CellVerticalAlignment
198 get => (VerticalAlignmentType?)GetValue(CellVerticalAlignmentProperty);
199 set => SetValue(CellVerticalAlignmentProperty, value);
202 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
203 [EditorBrowsable(EditorBrowsableState.Never)]
204 public View LeftFocusableView
206 get => (View)GetValue(LeftFocusableViewProperty);
207 set => SetValue(LeftFocusableViewProperty, value);
210 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
211 [EditorBrowsable(EditorBrowsableState.Never)]
212 public View RightFocusableView
214 get => (View)GetValue(RightFocusableViewProperty);
215 set => SetValue(RightFocusableViewProperty, value);
218 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
219 [EditorBrowsable(EditorBrowsableState.Never)]
220 public View UpFocusableView
222 get => (View)GetValue(UpFocusableViewProperty);
223 set => SetValue(UpFocusableViewProperty, value);
226 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
227 [EditorBrowsable(EditorBrowsableState.Never)]
228 public View DownFocusableView
230 get => (View)GetValue(DownFocusableViewProperty);
231 set => SetValue(DownFocusableViewProperty, value);
234 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
235 [EditorBrowsable(EditorBrowsableState.Never)]
236 public bool? Focusable
238 get => (bool?)GetValue(FocusableProperty);
239 set => SetValue(FocusableProperty, value);
242 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
243 [EditorBrowsable(EditorBrowsableState.Never)]
246 get => (Size2D)GetValue(Size2DProperty);
247 set => SetValue(Size2DProperty, value);
250 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
251 [EditorBrowsable(EditorBrowsableState.Never)]
252 public Selector<float?> Opacity
256 Selector<float?> opacity = (Selector<float?>)GetValue(OpacitySelectorProperty);
257 return (null != opacity) ? opacity : opacitySelector = new Selector<float?>();
259 set => SetValue(OpacitySelectorProperty, value);
262 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
263 [EditorBrowsable(EditorBrowsableState.Never)]
264 public Position2D Position2D
266 get => (Position2D)GetValue(Position2DProperty);
267 set => SetValue(Position2DProperty, value);
270 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
271 [EditorBrowsable(EditorBrowsableState.Never)]
272 public bool? PositionUsesPivotPoint
274 get => (bool?)GetValue(PositionUsesPivotPointProperty);
275 set => SetValue(PositionUsesPivotPointProperty, value);
278 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
279 [EditorBrowsable(EditorBrowsableState.Never)]
280 public int? SiblingOrder
282 get => (int?)GetValue(SiblingOrderProperty);
283 set => SetValue(SiblingOrderProperty, value);
286 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
287 [EditorBrowsable(EditorBrowsableState.Never)]
288 public Position ParentOrigin
290 get => (Position)GetValue(ParentOriginProperty);
291 set => SetValue(ParentOriginProperty, value);
294 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
295 [EditorBrowsable(EditorBrowsableState.Never)]
296 public Position PivotPoint
298 get => (Position)GetValue(PivotPointProperty);
299 set => SetValue(PivotPointProperty, value);
302 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
303 [EditorBrowsable(EditorBrowsableState.Never)]
304 public float? SizeWidth
306 get => (float?)GetValue(SizeWidthProperty);
307 set => SetValue(SizeWidthProperty, value);
310 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
311 [EditorBrowsable(EditorBrowsableState.Never)]
312 public float? SizeHeight
314 get => (float?)GetValue(SizeHeightProperty);
315 set => SetValue(SizeHeightProperty, value);
318 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
319 [EditorBrowsable(EditorBrowsableState.Never)]
320 public Position Position
322 get => (Position)GetValue(PositionProperty);
323 set => SetValue(PositionProperty, value);
326 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
327 [EditorBrowsable(EditorBrowsableState.Never)]
328 public float? PositionX
330 get => (float?)GetValue(PositionXProperty);
331 set => SetValue(PositionXProperty, value);
334 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
335 [EditorBrowsable(EditorBrowsableState.Never)]
336 public float? PositionY
338 get => (float?)GetValue(PositionYProperty);
339 set => SetValue(PositionYProperty, value);
342 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
343 [EditorBrowsable(EditorBrowsableState.Never)]
344 public float? PositionZ
346 get => (float?)GetValue(PositionZProperty);
347 set => SetValue(PositionZProperty, value);
350 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
351 [EditorBrowsable(EditorBrowsableState.Never)]
352 public Rotation Orientation
354 get => (Rotation)GetValue(OrientationProperty);
355 set => SetValue(OrientationProperty, value);
358 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
359 [EditorBrowsable(EditorBrowsableState.Never)]
362 get => (Vector3)GetValue(ScaleProperty);
363 set => SetValue(ScaleProperty, value);
366 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
367 [EditorBrowsable(EditorBrowsableState.Never)]
370 get => (float?)GetValue(ScaleXProperty);
371 set => SetValue(ScaleXProperty, value);
374 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
375 [EditorBrowsable(EditorBrowsableState.Never)]
378 get => (float?)GetValue(ScaleYProperty);
379 set => SetValue(ScaleYProperty, value);
382 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
383 [EditorBrowsable(EditorBrowsableState.Never)]
386 get => (float?)GetValue(ScaleZProperty);
387 set => SetValue(ScaleZProperty, value);
390 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
391 [EditorBrowsable(EditorBrowsableState.Never)]
394 get => (string)GetValue(NameProperty);
395 set => SetValue(NameProperty, value);
398 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
399 [EditorBrowsable(EditorBrowsableState.Never)]
400 public bool? Sensitive
402 get => (bool?)GetValue(SensitiveProperty);
403 set => SetValue(SensitiveProperty, value);
406 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
407 [EditorBrowsable(EditorBrowsableState.Never)]
408 public bool? LeaveRequired
410 get => (bool?)GetValue(LeaveRequiredProperty);
411 set => SetValue(LeaveRequiredProperty, value);
414 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
415 [EditorBrowsable(EditorBrowsableState.Never)]
416 public bool? InheritOrientation
418 get => (bool?)GetValue(InheritOrientationProperty);
419 set => SetValue(InheritOrientationProperty, value);
422 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
423 [EditorBrowsable(EditorBrowsableState.Never)]
424 public bool? InheritScale
426 get => (bool?)GetValue(InheritScaleProperty);
427 set => SetValue(InheritScaleProperty, value);
430 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
431 [EditorBrowsable(EditorBrowsableState.Never)]
432 public DrawModeType? DrawMode
434 get => (DrawModeType?)GetValue(DrawModeProperty);
435 set => SetValue(DrawModeProperty, value);
438 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
439 [EditorBrowsable(EditorBrowsableState.Never)]
440 public Vector3 SizeModeFactor
442 get => (Vector3)GetValue(SizeModeFactorProperty);
443 set => SetValue(SizeModeFactorProperty, value);
446 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
447 [EditorBrowsable(EditorBrowsableState.Never)]
448 public ResizePolicyType? WidthResizePolicy
450 get => (ResizePolicyType?)GetValue(WidthResizePolicyProperty);
451 set => SetValue(WidthResizePolicyProperty, value);
454 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
455 [EditorBrowsable(EditorBrowsableState.Never)]
456 public ResizePolicyType? HeightResizePolicy
458 get => (ResizePolicyType?)GetValue(HeightResizePolicyProperty);
459 set => SetValue(HeightResizePolicyProperty, value);
462 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
463 [EditorBrowsable(EditorBrowsableState.Never)]
464 public SizeScalePolicyType? SizeScalePolicy
466 get => (SizeScalePolicyType?)GetValue(SizeScalePolicyProperty);
467 set => SetValue(SizeScalePolicyProperty, value);
470 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
471 [EditorBrowsable(EditorBrowsableState.Never)]
472 public bool? WidthForHeight
474 get => (bool?)GetValue(WidthForHeightProperty);
475 set => SetValue(WidthForHeightProperty, value);
478 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
479 [EditorBrowsable(EditorBrowsableState.Never)]
480 public bool? HeightForWidth
482 get => (bool?)GetValue(HeightForWidthProperty);
483 set => SetValue(HeightForWidthProperty, value);
486 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
487 [EditorBrowsable(EditorBrowsableState.Never)]
488 public Extents Padding
492 Extents tmp = (Extents)GetValue(PaddingProperty);
493 return (null != tmp) ? tmp : padding = new Extents(OnPaddingChanged, 0, 0, 0, 0);
495 set => SetValue(PaddingProperty, value);
498 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
499 [EditorBrowsable(EditorBrowsableState.Never)]
500 public Size2D MinimumSize
502 get => (Size2D)GetValue(MinimumSizeProperty);
503 set => SetValue(MinimumSizeProperty, value);
506 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
507 [EditorBrowsable(EditorBrowsableState.Never)]
508 public Size2D MaximumSize
510 get => (Size2D)GetValue(MaximumSizeProperty);
511 set => SetValue(MaximumSizeProperty, value);
514 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
515 [EditorBrowsable(EditorBrowsableState.Never)]
516 public bool? InheritPosition
518 get => (bool?)GetValue(InheritPositionProperty);
519 set => SetValue(InheritPositionProperty, value);
522 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
523 [EditorBrowsable(EditorBrowsableState.Never)]
524 public ClippingModeType? ClippingMode
526 get => (ClippingModeType?)GetValue(ClippingModeProperty);
527 set => SetValue(ClippingModeProperty, value);
530 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
531 [EditorBrowsable(EditorBrowsableState.Never)]
536 Size tmp = (Size)GetValue(SizeProperty);
537 return (null != tmp) ? tmp : size = new Size((float? width, float? height, float? depth) =>
539 float targetWidth = 0;
540 float targetHeight = 0;
541 float targetDepth = 0;
545 targetWidth = size.Width;
546 targetHeight = size.Height;
547 targetDepth = size.Depth;
549 if (width != null) { targetWidth = (float)width; }
550 if (height != null) { targetHeight = (float)height; }
551 if (depth != null) { targetDepth = (float)depth; }
553 Size = new Size(targetWidth, targetHeight, targetDepth);
556 set => SetValue(SizeProperty, value);
559 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
560 [EditorBrowsable(EditorBrowsableState.Never)]
561 public bool? InheritLayoutDirection
563 get => (bool?)GetValue(InheritLayoutDirectionProperty);
564 set => SetValue(InheritLayoutDirectionProperty, value);
567 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
568 [EditorBrowsable(EditorBrowsableState.Never)]
569 public ViewLayoutDirectionType? LayoutDirection
571 get => (ViewLayoutDirectionType?)GetValue(LayoutDirectionProperty);
572 set => SetValue(LayoutDirectionProperty, value);
575 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
576 [EditorBrowsable(EditorBrowsableState.Never)]
577 public Extents Margin
581 Extents tmp = (Extents)GetValue(MarginProperty);
582 return (null != tmp) ? tmp : margin = new Extents(OnMarginChanged, 0, 0, 0, 0);
584 set => SetValue(MarginProperty, value);
587 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
588 [EditorBrowsable(EditorBrowsableState.Never)]
591 get => (float?)GetValue(WeightProperty);
592 set => SetValue(WeightProperty, value);
595 /// <summary> View BackgroundColor </summary>
596 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
597 [EditorBrowsable(EditorBrowsableState.Never)]
598 public Selector<Color> BackgroundColor
602 Selector<Color> color = (Selector<Color>)GetValue(BackgroundColorSelectorProperty);
603 return (null != color) ? color : backgroundColorSelector = new Selector<Color>();
605 set => SetValue(BackgroundColorSelectorProperty, value);
611 [EditorBrowsable(EditorBrowsableState.Never)]
612 public Selector<Color> Color
616 Selector<Color> color = (Selector<Color>)GetValue(ColorSelectorProperty);
617 return (null != color) ? color : colorSelector = new Selector<Color>();
619 set => SetValue(ColorSelectorProperty, value);
622 /// <summary>View BackgroundBorder</summary>
623 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
624 [EditorBrowsable(EditorBrowsableState.Never)]
625 public Selector<Rectangle> BackgroundImageBorder
629 Selector<Rectangle> border = (Selector<Rectangle>)GetValue(BackgroundImageBorderSelectorProperty);
630 return (null != border) ? border : backgroundImageBorderSelector = new Selector<Rectangle>();
632 set => SetValue(BackgroundImageBorderSelectorProperty, value);
636 /// Describes a shadow as an image for a View.
637 /// It is null by default.
640 /// If BoxShadow is not null, the ImageShadow value will be ignored.
642 [EditorBrowsable(EditorBrowsableState.Never)]
643 public Selector<ImageShadow> ImageShadow
645 get => (Selector<ImageShadow>)GetValue(ImageShadowSelectorProperty);
646 set => SetValue(ImageShadowSelectorProperty, value);
650 /// Describes a box shaped shadow drawing for a View.
651 /// It is null by default.
653 [EditorBrowsable(EditorBrowsableState.Never)]
654 public Selector<Shadow> BoxShadow
656 get => (Selector<Shadow>)GetValue(BoxShadowSelectorProperty);
657 set => SetValue(BoxShadowSelectorProperty, value);
661 /// The radius for the rounded corners of the View
663 [EditorBrowsable(EditorBrowsableState.Never)]
664 public Selector<float?> CornerRadius
666 get => (Selector<float?>)GetValue(CornerRadiusProperty);
667 set => SetValue(CornerRadiusProperty, value);
671 /// Whether the CornerRadius property value is relative (percentage [0.0f to 1.0f] of the view size) or absolute (in world units).
672 /// It is absolute by default.
673 /// When the policy is relative, the corner radius is relative to the smaller of the view's width and height.
675 [EditorBrowsable(EditorBrowsableState.Never)]
676 public VisualTransformPolicyType? CornerRadiusPolicy
678 get => (VisualTransformPolicyType?)GetValue(CornerRadiusPolicyProperty);
679 set => SetValue(CornerRadiusPolicyProperty, value);
683 /// The EnableControlState value of the View.
685 [EditorBrowsable(EditorBrowsableState.Never)]
686 public bool? EnableControlState
688 get => (bool?)GetValue(EnableControlStateProperty);
689 set => SetValue(EnableControlStateProperty, value);
693 /// The ThemeChangeSensitive value of the View.
695 [EditorBrowsable(EditorBrowsableState.Never)]
696 public bool? ThemeChangeSensitive
698 get => (bool?)GetValue(ThemeChangeSensitiveProperty);
699 set => SetValue(ThemeChangeSensitiveProperty, value);
704 /// Allow null properties when merging it into other Theme.
705 /// If the value is true, the null properties reset target properties of the other ViewStyle with same key when merge.
706 /// It is used in <seealso cref="Theme.Merge(string)"/>, <seealso cref="Theme.Merge(Theme)"/>.
707 /// It is also used in <seealso cref="Theme.GetStyle(string)"/> when the Theme has a parent and needs to merge.
708 /// Please note that it is false by default.
710 [EditorBrowsable(EditorBrowsableState.Never)]
711 public bool SolidNull { get; set; } = false;
714 /// Set style's bindable properties from the view.
716 /// <param name="view">The view that includes property data.</param>
717 [EditorBrowsable(EditorBrowsableState.Never)]
718 public virtual void CopyPropertiesFromView(View view)
720 if (view == null) return;
722 BindableProperty.GetBindablePropertysOfType(GetType(), out var styleProperties);
723 BindableProperty.GetBindablePropertysOfType(view.GetType(), out var viewProperties);
726 if (styleProperties == null || viewProperties == null) return;
728 foreach (var stylePropertyItem in styleProperties)
730 viewProperties.TryGetValue(stylePropertyItem.Key, out var viewProperty);
732 if (viewProperty == null) continue;
734 SetValue(stylePropertyItem.Value, view.GetValue(viewProperty));
738 /// <summary>Create a cloned ViewStyle.</summary>
739 [EditorBrowsable(EditorBrowsableState.Never)]
740 public ViewStyle Clone()
742 var cloned = CreateInstance();
743 cloned.CopyFrom(this);
748 /// <summary>Create a cloned ViewStyle.</summary>
749 [EditorBrowsable(EditorBrowsableState.Never)]
750 public void Merge(ViewStyle other)
752 AllowNullCopy = other?.SolidNull ?? false;
754 AllowNullCopy = false;
757 internal ViewStyle CreateInstance()
759 return (ViewStyle)Activator.CreateInstance(GetType());
762 private void OnPaddingChanged(ushort start, ushort end, ushort top, ushort bottom)
764 Padding = new Extents(start, end, top, bottom);
767 private void OnMarginChanged(ushort start, ushort end, ushort top, ushort bottom)
769 Margin = new Extents(start, end, top, bottom);