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;
90 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
91 [EditorBrowsable(EditorBrowsableState.Never)]
92 public ViewStyle() { }
94 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
95 [EditorBrowsable(EditorBrowsableState.Never)]
96 public ViewStyle(ViewStyle viewAttributes)
98 CopyFrom(viewAttributes);
102 /// Create an instance and set properties from the given view.
104 /// <param name="view">The View that includes property data.</param>
105 [EditorBrowsable(EditorBrowsableState.Never)]
106 public ViewStyle(View view)
108 CopyPropertiesFromView(view);
111 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
112 [EditorBrowsable(EditorBrowsableState.Never)]
113 public string StyleName
115 get => (string)GetValue(StyleNameProperty);
116 set => SetValue(StyleNameProperty, value);
119 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
120 [EditorBrowsable(EditorBrowsableState.Never)]
121 public Selector<string> BackgroundImage
125 Selector<string> image = (Selector<string>)GetValue(BackgroundImageSelectorProperty);
126 return (null != image) ? image : backgroundImageSelector = new Selector<string>();
128 set => SetValue(BackgroundImageSelectorProperty, value);
131 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
132 [EditorBrowsable(EditorBrowsableState.Never)]
133 public View.States? State
135 get => (View.States?)GetValue(StateProperty);
136 set => SetValue(StateProperty, value);
139 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
140 [EditorBrowsable(EditorBrowsableState.Never)]
141 public View.States? SubState
143 get => (View.States?)GetValue(SubStateProperty);
144 set => SetValue(SubStateProperty, value);
147 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
148 [EditorBrowsable(EditorBrowsableState.Never)]
151 get => (float?)GetValue(FlexProperty);
152 set => SetValue(FlexProperty, value);
155 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
156 [EditorBrowsable(EditorBrowsableState.Never)]
157 public int? AlignSelf
159 get => (int?)GetValue(AlignSelfProperty);
160 set => SetValue(AlignSelfProperty, value);
163 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
164 [EditorBrowsable(EditorBrowsableState.Never)]
165 public Vector4 FlexMargin
167 get => (Vector4)GetValue(FlexMarginProperty);
168 set => SetValue(FlexMarginProperty, value);
171 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
172 [EditorBrowsable(EditorBrowsableState.Never)]
173 public Vector2 CellIndex
175 get => (Vector2)GetValue(CellIndexProperty);
176 set => SetValue(CellIndexProperty, value);
179 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
180 [EditorBrowsable(EditorBrowsableState.Never)]
181 public float? RowSpan
183 get => (float?)GetValue(RowSpanProperty);
184 set => SetValue(RowSpanProperty, value);
187 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
188 [EditorBrowsable(EditorBrowsableState.Never)]
189 public float? ColumnSpan
191 get => (float?)GetValue(ColumnSpanProperty);
192 set => SetValue(ColumnSpanProperty, value);
195 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
196 [EditorBrowsable(EditorBrowsableState.Never)]
197 public HorizontalAlignmentType? CellHorizontalAlignment
199 get => (HorizontalAlignmentType?)GetValue(CellHorizontalAlignmentProperty);
200 set => SetValue(CellHorizontalAlignmentProperty, value);
203 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
204 [EditorBrowsable(EditorBrowsableState.Never)]
205 public VerticalAlignmentType? CellVerticalAlignment
207 get => (VerticalAlignmentType?)GetValue(CellVerticalAlignmentProperty);
208 set => SetValue(CellVerticalAlignmentProperty, value);
211 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
212 [EditorBrowsable(EditorBrowsableState.Never)]
213 public View LeftFocusableView
215 get => (View)GetValue(LeftFocusableViewProperty);
216 set => SetValue(LeftFocusableViewProperty, value);
219 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
220 [EditorBrowsable(EditorBrowsableState.Never)]
221 public View RightFocusableView
223 get => (View)GetValue(RightFocusableViewProperty);
224 set => SetValue(RightFocusableViewProperty, value);
227 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
228 [EditorBrowsable(EditorBrowsableState.Never)]
229 public View UpFocusableView
231 get => (View)GetValue(UpFocusableViewProperty);
232 set => SetValue(UpFocusableViewProperty, value);
235 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
236 [EditorBrowsable(EditorBrowsableState.Never)]
237 public View DownFocusableView
239 get => (View)GetValue(DownFocusableViewProperty);
240 set => SetValue(DownFocusableViewProperty, value);
243 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
244 [EditorBrowsable(EditorBrowsableState.Never)]
245 public bool? Focusable
247 get => (bool?)GetValue(FocusableProperty);
248 set => SetValue(FocusableProperty, value);
251 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
252 [EditorBrowsable(EditorBrowsableState.Never)]
255 get => (Size2D)GetValue(Size2DProperty);
256 set => SetValue(Size2DProperty, value);
259 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
260 [EditorBrowsable(EditorBrowsableState.Never)]
261 public Selector<float?> Opacity
265 Selector<float?> opacity = (Selector<float?>)GetValue(OpacitySelectorProperty);
266 return (null != opacity) ? opacity : opacitySelector = new Selector<float?>();
268 set => SetValue(OpacitySelectorProperty, value);
271 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
272 [EditorBrowsable(EditorBrowsableState.Never)]
273 public Position2D Position2D
275 get => (Position2D)GetValue(Position2DProperty);
276 set => SetValue(Position2DProperty, value);
279 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
280 [EditorBrowsable(EditorBrowsableState.Never)]
281 public bool? PositionUsesPivotPoint
283 get => (bool?)GetValue(PositionUsesPivotPointProperty);
284 set => SetValue(PositionUsesPivotPointProperty, value);
287 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
288 [EditorBrowsable(EditorBrowsableState.Never)]
289 public int? SiblingOrder
291 get => (int?)GetValue(SiblingOrderProperty);
292 set => SetValue(SiblingOrderProperty, value);
295 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
296 [EditorBrowsable(EditorBrowsableState.Never)]
297 public Position ParentOrigin
299 get => (Position)GetValue(ParentOriginProperty);
300 set => SetValue(ParentOriginProperty, value);
303 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
304 [EditorBrowsable(EditorBrowsableState.Never)]
305 public Position PivotPoint
307 get => (Position)GetValue(PivotPointProperty);
308 set => SetValue(PivotPointProperty, value);
311 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
312 [EditorBrowsable(EditorBrowsableState.Never)]
313 public float? SizeWidth
315 get => (float?)GetValue(SizeWidthProperty);
316 set => SetValue(SizeWidthProperty, value);
319 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
320 [EditorBrowsable(EditorBrowsableState.Never)]
321 public float? SizeHeight
323 get => (float?)GetValue(SizeHeightProperty);
324 set => SetValue(SizeHeightProperty, value);
327 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
328 [EditorBrowsable(EditorBrowsableState.Never)]
329 public Position Position
331 get => (Position)GetValue(PositionProperty);
332 set => SetValue(PositionProperty, value);
335 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
336 [EditorBrowsable(EditorBrowsableState.Never)]
337 public float? PositionX
339 get => (float?)GetValue(PositionXProperty);
340 set => SetValue(PositionXProperty, value);
343 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
344 [EditorBrowsable(EditorBrowsableState.Never)]
345 public float? PositionY
347 get => (float?)GetValue(PositionYProperty);
348 set => SetValue(PositionYProperty, value);
351 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
352 [EditorBrowsable(EditorBrowsableState.Never)]
353 public float? PositionZ
355 get => (float?)GetValue(PositionZProperty);
356 set => SetValue(PositionZProperty, value);
359 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
360 [EditorBrowsable(EditorBrowsableState.Never)]
361 public Rotation Orientation
363 get => (Rotation)GetValue(OrientationProperty);
364 set => SetValue(OrientationProperty, value);
367 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
368 [EditorBrowsable(EditorBrowsableState.Never)]
371 get => (Vector3)GetValue(ScaleProperty);
372 set => SetValue(ScaleProperty, value);
375 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
376 [EditorBrowsable(EditorBrowsableState.Never)]
379 get => (float?)GetValue(ScaleXProperty);
380 set => SetValue(ScaleXProperty, value);
383 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
384 [EditorBrowsable(EditorBrowsableState.Never)]
387 get => (float?)GetValue(ScaleYProperty);
388 set => SetValue(ScaleYProperty, value);
391 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
392 [EditorBrowsable(EditorBrowsableState.Never)]
395 get => (float?)GetValue(ScaleZProperty);
396 set => SetValue(ScaleZProperty, value);
399 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
400 [EditorBrowsable(EditorBrowsableState.Never)]
403 get => (string)GetValue(NameProperty);
404 set => SetValue(NameProperty, value);
407 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
408 [EditorBrowsable(EditorBrowsableState.Never)]
409 public bool? Sensitive
411 get => (bool?)GetValue(SensitiveProperty);
412 set => SetValue(SensitiveProperty, value);
415 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
416 [EditorBrowsable(EditorBrowsableState.Never)]
417 public bool? LeaveRequired
419 get => (bool?)GetValue(LeaveRequiredProperty);
420 set => SetValue(LeaveRequiredProperty, value);
423 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
424 [EditorBrowsable(EditorBrowsableState.Never)]
425 public bool? InheritOrientation
427 get => (bool?)GetValue(InheritOrientationProperty);
428 set => SetValue(InheritOrientationProperty, value);
431 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
432 [EditorBrowsable(EditorBrowsableState.Never)]
433 public bool? InheritScale
435 get => (bool?)GetValue(InheritScaleProperty);
436 set => SetValue(InheritScaleProperty, value);
439 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
440 [EditorBrowsable(EditorBrowsableState.Never)]
441 public DrawModeType? DrawMode
443 get => (DrawModeType?)GetValue(DrawModeProperty);
444 set => SetValue(DrawModeProperty, value);
447 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
448 [EditorBrowsable(EditorBrowsableState.Never)]
449 public Vector3 SizeModeFactor
451 get => (Vector3)GetValue(SizeModeFactorProperty);
452 set => SetValue(SizeModeFactorProperty, value);
455 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
456 [EditorBrowsable(EditorBrowsableState.Never)]
457 public ResizePolicyType? WidthResizePolicy
459 get => (ResizePolicyType?)GetValue(WidthResizePolicyProperty);
460 set => SetValue(WidthResizePolicyProperty, value);
463 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
464 [EditorBrowsable(EditorBrowsableState.Never)]
465 public ResizePolicyType? HeightResizePolicy
467 get => (ResizePolicyType?)GetValue(HeightResizePolicyProperty);
468 set => SetValue(HeightResizePolicyProperty, value);
471 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
472 [EditorBrowsable(EditorBrowsableState.Never)]
473 public SizeScalePolicyType? SizeScalePolicy
475 get => (SizeScalePolicyType?)GetValue(SizeScalePolicyProperty);
476 set => SetValue(SizeScalePolicyProperty, value);
479 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
480 [EditorBrowsable(EditorBrowsableState.Never)]
481 public bool? WidthForHeight
483 get => (bool?)GetValue(WidthForHeightProperty);
484 set => SetValue(WidthForHeightProperty, value);
487 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
488 [EditorBrowsable(EditorBrowsableState.Never)]
489 public bool? HeightForWidth
491 get => (bool?)GetValue(HeightForWidthProperty);
492 set => SetValue(HeightForWidthProperty, value);
495 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
496 [EditorBrowsable(EditorBrowsableState.Never)]
497 public Extents Padding
501 Extents tmp = (Extents)GetValue(PaddingProperty);
502 return (null != tmp) ? tmp : padding = new Extents(OnPaddingChanged, 0, 0, 0, 0);
504 set => SetValue(PaddingProperty, value);
507 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
508 [EditorBrowsable(EditorBrowsableState.Never)]
509 public Size2D MinimumSize
511 get => (Size2D)GetValue(MinimumSizeProperty);
512 set => SetValue(MinimumSizeProperty, value);
515 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
516 [EditorBrowsable(EditorBrowsableState.Never)]
517 public Size2D MaximumSize
519 get => (Size2D)GetValue(MaximumSizeProperty);
520 set => SetValue(MaximumSizeProperty, value);
523 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
524 [EditorBrowsable(EditorBrowsableState.Never)]
525 public bool? InheritPosition
527 get => (bool?)GetValue(InheritPositionProperty);
528 set => SetValue(InheritPositionProperty, value);
531 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
532 [EditorBrowsable(EditorBrowsableState.Never)]
533 public ClippingModeType? ClippingMode
535 get => (ClippingModeType?)GetValue(ClippingModeProperty);
536 set => SetValue(ClippingModeProperty, value);
539 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
540 [EditorBrowsable(EditorBrowsableState.Never)]
545 Size tmp = (Size)GetValue(SizeProperty);
546 return (null != tmp) ? tmp : size = new Size((float? width, float? height, float? depth) =>
548 float targetWidth = 0;
549 float targetHeight = 0;
550 float targetDepth = 0;
554 targetWidth = size.Width;
555 targetHeight = size.Height;
556 targetDepth = size.Depth;
558 if (width != null) { targetWidth = (float)width; }
559 if (height != null) { targetHeight = (float)height; }
560 if (depth != null) { targetDepth = (float)depth; }
562 Size = new Size(targetWidth, targetHeight, targetDepth);
565 set => SetValue(SizeProperty, value);
568 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
569 [EditorBrowsable(EditorBrowsableState.Never)]
570 public bool? InheritLayoutDirection
572 get => (bool?)GetValue(InheritLayoutDirectionProperty);
573 set => SetValue(InheritLayoutDirectionProperty, value);
576 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
577 [EditorBrowsable(EditorBrowsableState.Never)]
578 public ViewLayoutDirectionType? LayoutDirection
580 get => (ViewLayoutDirectionType?)GetValue(LayoutDirectionProperty);
581 set => SetValue(LayoutDirectionProperty, value);
584 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
585 [EditorBrowsable(EditorBrowsableState.Never)]
586 public Extents Margin
590 Extents tmp = (Extents)GetValue(MarginProperty);
591 return (null != tmp) ? tmp : margin = new Extents(OnMarginChanged, 0, 0, 0, 0);
593 set => SetValue(MarginProperty, value);
596 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
597 [EditorBrowsable(EditorBrowsableState.Never)]
600 get => (float?)GetValue(WeightProperty);
601 set => SetValue(WeightProperty, value);
604 /// <summary> View BackgroundColor </summary>
605 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
606 [EditorBrowsable(EditorBrowsableState.Never)]
607 public Selector<Color> BackgroundColor
611 Selector<Color> color = (Selector<Color>)GetValue(BackgroundColorSelectorProperty);
612 return (null != color) ? color : backgroundColorSelector = new Selector<Color>();
614 set => SetValue(BackgroundColorSelectorProperty, value);
620 [EditorBrowsable(EditorBrowsableState.Never)]
621 public Selector<Color> Color
625 Selector<Color> color = (Selector<Color>)GetValue(ColorSelectorProperty);
626 return (null != color) ? color : colorSelector = new Selector<Color>();
628 set => SetValue(ColorSelectorProperty, value);
631 /// <summary>View BackgroundBorder</summary>
632 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
633 [EditorBrowsable(EditorBrowsableState.Never)]
634 public Selector<Rectangle> BackgroundImageBorder
638 Selector<Rectangle> border = (Selector<Rectangle>)GetValue(BackgroundImageBorderSelectorProperty);
639 return (null != border) ? border : backgroundImageBorderSelector = new Selector<Rectangle>();
641 set => SetValue(BackgroundImageBorderSelectorProperty, value);
645 /// Describes a shadow as an image for a View.
646 /// It is null by default.
649 /// If BoxShadow is not null, the ImageShadow value will be ignored.
651 [EditorBrowsable(EditorBrowsableState.Never)]
652 public Selector<ImageShadow> ImageShadow
654 get => (Selector<ImageShadow>)GetValue(ImageShadowSelectorProperty);
655 set => SetValue(ImageShadowSelectorProperty, value);
659 /// Describes a box shaped shadow drawing for a View.
660 /// It is null by default.
662 [EditorBrowsable(EditorBrowsableState.Never)]
663 public Selector<Shadow> BoxShadow
665 get => (Selector<Shadow>)GetValue(BoxShadowSelectorProperty);
666 set => SetValue(BoxShadowSelectorProperty, value);
670 /// The radius for the rounded corners of the View
672 [EditorBrowsable(EditorBrowsableState.Never)]
673 public Selector<float?> CornerRadius
675 get => (Selector<float?>)GetValue(CornerRadiusProperty);
676 set => SetValue(CornerRadiusProperty, value);
680 /// The EnableControlState value of the View.
682 [EditorBrowsable(EditorBrowsableState.Never)]
683 public bool? EnableControlState
685 get => (bool?)GetValue(EnableControlStateProperty);
686 set => SetValue(EnableControlStateProperty, value);
690 /// The ThemeChangeSensitive value of the View.
692 [EditorBrowsable(EditorBrowsableState.Never)]
693 public bool? ThemeChangeSensitive
695 get => (bool?)GetValue(ThemeChangeSensitiveProperty);
696 set => SetValue(ThemeChangeSensitiveProperty, value);
701 /// Allow null properties when merging it into other Theme.
702 /// If the value is true, the null properties reset target properties of the other ViewStyle with same key when merge.
703 /// It is used in <seealso cref="Theme.Merge(string)"/>, <seealso cref="Theme.Merge(Theme)"/>.
704 /// It is also used in <seealso cref="Theme.GetStyle(string)"/> when the Theme has a parent and needs to merge.
705 /// Please note that it is false by default.
707 [EditorBrowsable(EditorBrowsableState.Never)]
708 public bool SolidNull { get; set; } = false;
711 /// Set style's bindable properties from the view.
713 /// <param name="view">The view that includes property data.</param>
714 [EditorBrowsable(EditorBrowsableState.Never)]
715 public virtual void CopyPropertiesFromView(View view)
717 if (view == null) return;
719 BindableProperty.GetBindablePropertysOfType(GetType(), out var styleProperties);
720 BindableProperty.GetBindablePropertysOfType(view.GetType(), out var viewProperties);
723 if (styleProperties == null || viewProperties == null) return;
725 foreach (var stylePropertyItem in styleProperties)
727 viewProperties.TryGetValue(stylePropertyItem.Key, out var viewProperty);
729 if (viewProperty == null) continue;
731 SetValue(stylePropertyItem.Value, view.GetValue(viewProperty));
735 /// <summary>Create a cloned ViewStyle.</summary>
736 [EditorBrowsable(EditorBrowsableState.Never)]
737 public ViewStyle Clone()
739 var cloned = CreateInstance();
740 cloned.CopyFrom(this);
745 /// <summary>Create a cloned ViewStyle.</summary>
746 [EditorBrowsable(EditorBrowsableState.Never)]
747 public void Merge(ViewStyle other)
749 AllowNullCopy = other?.SolidNull ?? false;
751 AllowNullCopy = false;
754 internal ViewStyle CreateInstance()
756 return (ViewStyle)Activator.CreateInstance(GetType());
759 private void OnPaddingChanged(ushort start, ushort end, ushort top, ushort bottom)
761 Padding = new Extents(start, end, top, bottom);
764 private void OnMarginChanged(ushort start, ushort end, ushort top, ushort bottom)
766 Margin = new Extents(start, end, top, bottom);