{
get
{
- return Style.Text.Text.GetValue(ControlState);
+ return Style?.Text?.Text?.GetValue(ControlState);
}
set
{
- Style.Text.Text = value;
+ if (null != Style?.Text)
+ {
+ Style.Text.Text = value;
+ }
}
}
}
set
{
- if (value != null)
+ if (null != Style?.Text)
{
- if (Style.Text.TranslatableText == null)
- {
- Style.Text.TranslatableText = new Selector<string>();
- }
- Style.Text.TranslatableText.All = value;
+ Style.Text.TranslatableText = value;
}
}
}
}
set
{
- if (Style.Text.PointSize == null)
+ if (null != Style?.Text)
{
- Style.Text.PointSize = new Selector<float?>();
+ Style.Text.PointSize = value;
}
- Style.Text.PointSize.All = value;
}
}
}
set
{
- Style.Text.FontFamily = value;
+ if (null != Style?.Text)
+ {
+ Style.Text.FontFamily = value;
+ }
}
}
/// <summary>
}
set
{
- if (Style.Text.TextColor == null)
+ if (null != Style?.Text)
{
- Style.Text.TextColor = new Selector<Color>();
+ Style.Text.TextColor = value;
}
- Style.Text.TextColor.All = value;
}
}
/// <summary>
}
set
{
- Style.Text.HorizontalAlignment = value;
+ if (null != Style?.Text)
+ {
+ Style.Text.HorizontalAlignment = value;
+ }
}
}
/// <summary>
}
set
{
- if (value != null)
+ if (null != Style?.Icon)
{
- if (Style.Icon.ResourceUrl == null)
- {
- Style.Icon.ResourceUrl = new Selector<string>();
- }
- Style.Icon.ResourceUrl.All = value;
+ Style.Icon.ResourceUrl = value;
}
}
}
}
set
{
- if (value != null)
+ if (null != value && null != Style.Text)
{
Style.Text.Text = value.Clone() as StringSelector;
}
}
set
{
- if (value != null)
+ if (null != value && null != Style?.Text)
{
Style.Text.TranslatableText = value.Clone() as StringSelector;
}
}
set
{
- if(value != null)
+ if(null != value && null != Style.Text)
{
Style.Text.TextColor = value.Clone() as ColorSelector;
}
}
set
{
- if (value != null)
+ if (null != value && null != Style?.Text)
{
Style.Text.PointSize = value.Clone() as FloatSelector;
}
}
set
{
- if (value != null)
+ if (null != value && null != Style?.Icon)
{
Style.Icon.ResourceUrl = value.Clone() as StringSelector;
}
{
get
{
- return Style.Icon.Padding;
+ return Style?.Icon?.Padding;
}
set
{
- if (null != value)
+ if (null != value && null != Style?.Icon?.Padding)
{
Style.Icon.Padding.CopyFrom(value);
}
{
get
{
- return Style.Text.Padding;
+ return Style?.Text?.Padding;
}
set
{
- if (null != value)
+ if (null != value && null != Style?.Text?.Padding)
{
Style.Text.Padding.CopyFrom(value);
}
[EditorBrowsable(EditorBrowsableState.Never)]
public void DeleteItem(int index)
{
- if(index < 0 || index >= adapter.GetItemCount())
- {
- return;
- }
+ if (index < 0 || index >= adapter?.GetItemCount()) return;
+ if (null == dropDownMenuFullList) return;
if (selectedItemIndex == index)
{
selectedItemIndex--;
}
- adapter.RemoveData(index);
+ adapter?.RemoveData(index);
if(index < dropDownMenuFullList.ChildCount)
{
private void UpdateSelectedItem(int index)
{
+ if (null == adapter) return;
+ if (null == dropDownMenuFullList) return;
if (selectedItemIndex != -1)
{
DropDownDataItem data = adapter.GetData(selectedItemIndex);
- if(data != null)
+ if(null != data)
{
data.IsSelected = false;
}
if (index != -1)
{
DropDownDataItem data = adapter.GetData(index);
- if (data != null)
+ if (null != data)
{
data.IsSelected = true;
DropDownItemView listItemView = dropDownMenuFullList?.GetChildAt((uint)index) as DropDownItemView;
}
set
{
- if (null == itemDataStyle.BackgroundColor)
+ if (null == itemDataStyle?.BackgroundColor)
{
itemDataStyle.BackgroundColor = new Selector<Color>();
}
imageView = new ImageView();
this.Add(imageView);
}
+ imageView.ApplyStyle(imageControlStyle.Image);
}
-
- imageView.ApplyStyle(imageControlStyle.Image);
}
/// <summary>
{
get
{
- return textField.Text;
+ return textField?.Text;
}
set
{
- textField.Text = value;
+ if (null != textField) textField.Text = value;
}
}
{
get
{
- return textField.PlaceholderText;
+ return textField?.PlaceholderText;
}
set
{
- textField.PlaceholderText = value;
+ if (null != textField) textField.PlaceholderText = value;
}
}
{
get
{
- return textField.TextColor;
+ return textField?.TextColor;
}
set
{
CreateTextFieldAttributes();
- if (null == inputFieldAttrs.InputBoxAttributes.TextColor)
+ if (null != inputFieldAttrs?.InputBoxAttributes)
{
- inputFieldAttrs.InputBoxAttributes.TextColor = new Selector<Color>();
+ inputFieldAttrs.InputBoxAttributes.TextColor = value;
+ if (null != textField) textField.TextColor = value;
}
- inputFieldAttrs.InputBoxAttributes.TextColor.All = value;
- textField.TextColor = value;
}
}
{
get
{
- return textField.PlaceholderTextColor;
+ return textField?.PlaceholderTextColor;
}
set
{
CreateTextFieldAttributes();
- if (null == inputFieldAttrs.InputBoxAttributes.PlaceholderTextColor)
+ if (null != inputFieldAttrs?.InputBoxAttributes)
{
- inputFieldAttrs.InputBoxAttributes.PlaceholderTextColor = new Selector<Color>();
+ inputFieldAttrs.InputBoxAttributes.PlaceholderTextColor = value;
+ if (null != textField) textField.PlaceholderTextColor = value;
}
- inputFieldAttrs.InputBoxAttributes.PlaceholderTextColor.All = value;
- textField.PlaceholderTextColor = value;
}
}
{
get
{
- return textField.PrimaryCursorColor;
+ return textField?.PrimaryCursorColor;
}
set
{
CreateTextFieldAttributes();
- if (null == inputFieldAttrs.InputBoxAttributes.PrimaryCursorColor)
+ if (null == inputFieldAttrs?.InputBoxAttributes)
{
- inputFieldAttrs.InputBoxAttributes.PrimaryCursorColor = new Selector<Color>();
+ inputFieldAttrs.InputBoxAttributes.PrimaryCursorColor = value;
+ if (null != textField) textField.PrimaryCursorColor = value;
}
- inputFieldAttrs.InputBoxAttributes.PrimaryCursorColor.All = value;
- textField.PrimaryCursorColor = value;
}
}
{
get
{
- return textField.FontFamily;
+ return textField?.FontFamily;
}
set
{
CreateTextFieldAttributes();
- inputFieldAttrs.InputBoxAttributes.FontFamily = value;
- textField.FontFamily = value;
+ if (null != inputFieldAttrs?.InputBoxAttributes)
+ {
+ inputFieldAttrs.InputBoxAttributes.FontFamily = value;
+ if (null != textField) textField.FontFamily = value;
+ }
}
}
{
get
{
- return textField.EnableCursorBlink;
+ return textField?.EnableCursorBlink ?? false;
}
set
{
CreateTextFieldAttributes();
- inputFieldAttrs.InputBoxAttributes.EnableCursorBlink = value;
- textField.EnableCursorBlink = value;
+ if (null != inputFieldAttrs.InputBoxAttributes)
+ {
+ inputFieldAttrs.InputBoxAttributes.EnableCursorBlink = value;
+ if (null != textField) textField.EnableCursorBlink = value;
+ }
}
}
{
get
{
- return textField.EnableSelection;
+ return textField?.EnableSelection ?? false;
}
set
{
CreateTextFieldAttributes();
- inputFieldAttrs.InputBoxAttributes.EnableSelection = value;
- textField.EnableSelection = value;
+ if (null != inputFieldAttrs?.InputBoxAttributes)
+ {
+ inputFieldAttrs.InputBoxAttributes.EnableSelection = value;
+ if (null != textField) textField.EnableSelection = value;
+ }
}
}
{
get
{
- return textField.CursorWidth;
+ return textField?.CursorWidth ?? 0;
}
set
{
CreateTextFieldAttributes();
- inputFieldAttrs.InputBoxAttributes.CursorWidth = value;
- textField.CursorWidth = value;
+ if (null != inputFieldAttrs.InputBoxAttributes)
+ {
+ inputFieldAttrs.InputBoxAttributes.CursorWidth = value;
+ if (null != textField) textField.CursorWidth = value;
+ }
}
}
{
get
{
- return textField.Ellipsis;
+ return textField?.Ellipsis ?? false;
}
set
{
CreateTextFieldAttributes();
- inputFieldAttrs.InputBoxAttributes.Ellipsis = value;
- textField.Ellipsis = value;
+ if (null != inputFieldAttrs.InputBoxAttributes)
+ {
+ inputFieldAttrs.InputBoxAttributes.Ellipsis = value;
+ if (null != textField) textField.Ellipsis = value;
+ }
}
}
{
get
{
- return inputFieldAttrs.BackgroundImageAttributes?.ResourceUrl?.All;
+ return inputFieldAttrs?.BackgroundImageAttributes?.ResourceUrl?.All;
}
set
{
- if (value != null)
+ CreateBackgroundAttributes();
+ if (null != inputFieldAttrs?.BackgroundImageAttributes)
{
- CreateBackgroundAttributes();
- if (inputFieldAttrs.BackgroundImageAttributes.ResourceUrl == null)
- {
- inputFieldAttrs.BackgroundImageAttributes.ResourceUrl = new Selector<string>();
- }
- inputFieldAttrs.BackgroundImageAttributes.ResourceUrl.All = value;
+ inputFieldAttrs.BackgroundImageAttributes.ResourceUrl = value;
RelayoutRequest();
}
}
{
get
{
- return inputFieldAttrs.BackgroundImageAttributes?.Border?.All;
+ return inputFieldAttrs?.BackgroundImageAttributes?.Border?.All;
}
set
{
- if (value != null)
+ CreateBackgroundAttributes();
+ if (null != inputFieldAttrs?.BackgroundImageAttributes)
{
- CreateBackgroundAttributes();
- if (inputFieldAttrs.BackgroundImageAttributes.Border == null)
- {
- inputFieldAttrs.BackgroundImageAttributes.Border = new Selector<Rectangle>();
- }
- inputFieldAttrs.BackgroundImageAttributes.Border.All = value;
+ inputFieldAttrs.BackgroundImageAttributes.Border = value;
RelayoutRequest();
}
}
{
get
{
- return inputFieldAttrs.Space ?? 0;
+ return inputFieldAttrs?.Space ?? 0;
}
set
{
- inputFieldAttrs.Space = value;
- RelayoutRequest();
+ if (null != inputFieldAttrs)
+ {
+ inputFieldAttrs.Space = value;
+ RelayoutRequest();
+ }
}
}
{
Size size = (Size)newValue;
instance.Style.Size = size;
- //insbase.Size = value;
- instance.imageVisual.Size = new Size2D((int)size.Width, (int)size.Height);
+ if (null != instance.imageVisual)
+ {
+ instance.imageVisual.Size = new Size2D((int)size.Width, (int)size.Height);
+ }
}
},
defaultValueCreator: (bindable) =>
var instance = (Popup)bindable;
if (newValue != null)
{
- if (instance.Style.ShadowOffset == null)
+ if (null != instance.Style)
{
- instance.Style.ShadowOffset = new Vector4(0, 0, 0, 0);
+ instance.Style.ShadowOffset = (Vector4)newValue;
+ instance.UpdateShadow();
}
- instance.Style.ShadowOffset = (Vector4)newValue;
- instance.UpdateShadow();
}
},
defaultValueCreator: (bindable) =>
var instance = (Popup)bindable;
if (newValue != null)
{
- instance.Style.Buttons.Size.Height = (int)newValue;
- instance.UpdateButton();
+ if (null != instance.Style?.Buttons?.Size)
+ {
+ instance.Style.Buttons.Size.Height = (int)newValue;
+ instance.UpdateButton();
+ }
}
},
defaultValueCreator: (bindable) =>
var instance = (Popup)bindable;
if (newValue != null)
{
- if (instance.Style.Buttons.Text.PointSize == null)
+ if (null != instance.Style?.Buttons?.Text)
{
- instance.Style.Buttons.Text.PointSize = new Selector<float?>();
+ instance.Style.Buttons.Text.PointSize = (float)newValue;
+ instance.UpdateButton();
}
- instance.Style.Buttons.Text.PointSize.All = (float)newValue;
- instance.UpdateButton();
}
},
defaultValueCreator: (bindable) =>
var instance = (Popup)bindable;
if (newValue != null)
{
- instance.Style.Buttons.Text.FontFamily = (string)newValue;
- instance.UpdateButton();
+ if (null != instance.Style?.Buttons?.Text)
+ {
+ instance.Style.Buttons.Text.FontFamily = (string)newValue;
+ instance.UpdateButton();
+ }
}
},
defaultValueCreator: (bindable) =>
{
var instance = (Popup)bindable;
if (newValue != null)
- {
- if (instance.Style.Buttons.Text.TextColor == null)
+ {
+ if (null != instance.Style?.Buttons?.Text)
{
- instance.Style.Buttons.Text.TextColor = new Selector<Color>();
+ instance.Style.Buttons.Text.TextColor = (Color)newValue;
}
- instance.Style.Buttons.Text.TextColor.All = (Color)newValue;
- //instance.UpdateButton();
}
},
defaultValueCreator: (bindable) =>
var instance = (Popup)bindable;
if (newValue != null)
{
- instance.Style.Buttons.Overlay.BackgroundColor = (Selector<Color>)newValue;
- instance.UpdateButton();
+ if (null != instance.Style?.Buttons?.Overlay)
+ {
+ Selector<Color> color = (Selector<Color>)newValue;
+ if (null == instance.Style.Buttons.Overlay.BackgroundColor)
+ {
+ instance.Style.Buttons.Overlay.BackgroundColor = new Selector<Color>();
+ }
+ instance.Style.Buttons.Overlay.BackgroundColor.Clone(color);
+ instance.UpdateButton();
+ }
}
},
defaultValueCreator: (bindable) =>
var instance = (Popup)bindable;
if (newValue != null)
{
- instance.Style.Buttons.Text.HorizontalAlignment = (HorizontalAlignment)newValue;
- instance.UpdateButton();
+ if (null != instance.Style?.Buttons?.Text)
+ {
+ instance.Style.Buttons.Text.HorizontalAlignment = (HorizontalAlignment)newValue;
+ instance.UpdateButton();
+ }
}
},
defaultValueCreator: (bindable) =>
var instance = (Popup)bindable;
if (newValue != null)
{
- if (instance.Style.Buttons.Background.ResourceUrl == null)
+ if (null != instance.Style?.Buttons?.Background)
{
- instance.Style.Buttons.Background.ResourceUrl = new Selector<string>();
+ instance.Style.Buttons.Background.ResourceUrl = (string)newValue;
+ instance.UpdateButton();
}
- instance.Style.Buttons.Background.ResourceUrl.All = (string)newValue;
- instance.UpdateButton();
}
},
defaultValueCreator: (bindable) =>
var instance = (Popup)bindable;
if (newValue != null)
{
- if (instance.Style.Buttons.Background.Border == null)
+ if (null != instance.Style?.Buttons?.Background)
{
- instance.Style.Buttons.Background.Border = new Selector<Rectangle>();
+ instance.Style.Buttons.Background.Border = (Rectangle)newValue;
+ instance.UpdateButton();
}
- instance.Style.Buttons.Background.Border.All = (Rectangle)newValue;
- instance.UpdateButton();
}
},
defaultValueCreator: (bindable) =>
{
get
{
- return Style.Title?.Text?.All;
+ return Style?.Title?.Text?.All;
}
set
{
- if (value != null)
+ if (null != Style?.Title)
{
- //CreateTitleTextAttributes();
- if (Style.Title.Text == null)
- {
- Style.Title.Text = new StringSelector();
- }
- Style.Title.Text.All = value;
-
- //RelayoutRequest();
+ Style.Title.Text = value;
}
}
}
{
get
{
- return Style.Title?.PointSize?.All ?? 0;
+ return Style?.Title?.PointSize?.All ?? 0;
}
set
{
- //CreateTitleTextAttributes();
- if (Style.Title.PointSize == null)
+ if (null != Style?.Title)
{
- Style.Title.PointSize = new FloatSelector();
+ Style.Title.PointSize = value;
}
- Style.Title.PointSize.All = value;
- //RelayoutRequest();
}
}
{
get
{
- return Style.Title?.TextColor?.All;
+ return Style?.Title?.TextColor?.All;
}
set
{
- //CreateTitleTextAttributes();
- if (Style.Title.TextColor == null)
+ if (null != Style?.Title)
{
- Style.Title.TextColor = new ColorSelector();
+ Style.Title.TextColor = value;
}
- Style.Title.TextColor.All = value;
- //RelayoutRequest();
}
}
{
get
{
- return Style.Title?.HorizontalAlignment ?? HorizontalAlignment.Center;
+ return Style?.Title?.HorizontalAlignment ?? HorizontalAlignment.Center;
}
set
{
- //CreateTitleTextAttributes();
Style.Title.HorizontalAlignment = value;
- //RelayoutRequest();
}
}
{
get
{
- return Style.Title?.Position ?? new Position(0, 0, 0);
+ return Style?.Title?.Position ?? new Position(0, 0, 0);
}
set
{
- //CreateTitleTextAttributes();
Style.Title.Position = value;
- //RelayoutRequest();
}
}
{
get
{
- return (int)(Style.Title?.Size?.Height ?? 0);
+ return (int)(Style?.Title?.Size?.Height ?? 0);
}
set
{
- //CreateTitleTextAttributes();
Style.Title.Size.Height = value;
- //RelayoutRequest();
}
}
private void UpdateButton()
{
if (buttonCount <= 0) return;
- if (buttonTextList.Count != buttonCount) return;
+ if (null == buttonTextList || buttonTextList.Count != buttonCount) return;
- if (buttonList != null)
+ if (null != buttonList)
{
foreach (Button btn in buttonList)
{
- btn.ClickEvent -= ButtonClickEvent;
- this.Remove(btn);
- btn.Dispose();
+ if (null != btn)
+ {
+ btn.ClickEvent -= ButtonClickEvent;
+ this.Remove(btn);
+ btn.Dispose();
+ }
}
buttonList.Clear();
}
- int buttonWidth = Size2D.Width / buttonCount;
- int buttonHeight = (int)Style.Buttons.Size.Height;
+ int sizeWidth = Size2D?.Width ?? 0;
+ int buttonWidth = sizeWidth / buttonCount;
+ int buttonHeight = (int)(Style?.Buttons?.Size?.Height ?? 0);
for (int i = 0; i < buttonCount; i++)
{
- Button btn = new Button(Style.Buttons);
+ Button btn = new Button(Style?.Buttons);
btn.Size2D = new Size2D(buttonWidth, buttonHeight);
btn.Style.Text.Text = buttonTextList[i];
btn.ClickEvent += ButtonClickEvent;
}
int pos = 0;
- if (buttonList != null && buttonList.Count > 0)
+ if (null != buttonList && buttonList.Count > 0)
{
if (LayoutDirection == ViewLayoutDirectionType.RTL)
{
{
get
{
- return Style.Track?.ResourceUrl?.All;
+ return Style?.Track?.ResourceUrl?.All;
}
set
{
- //CreateTrackImageAttributes();
- if (Style.Track.ResourceUrl == null)
+ if (null != Style?.Track)
{
- Style.Track.ResourceUrl = new StringSelector();
+ Style.Track.ResourceUrl = value;
}
- Style.Track.ResourceUrl.All = value;
- //RelayoutRequest();
}
}
{
get
{
- return Style.Progress?.ResourceUrl?.All;
+ return Style?.Progress?.ResourceUrl?.All;
}
set
{
- //CreateProgressImageAttributes();
- if (Style.Progress.ResourceUrl == null)
+ if (null != Style?.Progress)
{
- Style.Progress.ResourceUrl = new StringSelector();
+ Style.Progress.ResourceUrl = value;
}
- Style.Progress.ResourceUrl.All = value;
- //RelayoutRequest();
}
}
{
get
{
- return Style.Buffer?.ResourceUrl?.All;
+ return Style?.Buffer?.ResourceUrl?.All;
}
set
{
- //CreateBufferImageAttributes();
- if (Style.Buffer.ResourceUrl == null)
+ if (null != Style?.Buffer)
{
- Style.Buffer.ResourceUrl = new StringSelector();
+ Style.Buffer.ResourceUrl = value;
+ RelayoutRequest();
}
- Style.Buffer.ResourceUrl.All = value;
- RelayoutRequest();
}
}
{
get
{
- return Style.Track?.BackgroundColor?.All;
+ return Style?.Track?.BackgroundColor?.All;
}
set
{
- //CreateTrackImageAttributes();
- if (Style.Track.BackgroundColor == null)
+ if (null != Style?.Track)
{
- Style.Track.BackgroundColor = new ColorSelector();
+ Style.Track.BackgroundColor = value;
}
- Style.Track.BackgroundColor.All = value;
- //RelayoutRequest();
}
}
{
get
{
- return Style.Progress?.BackgroundColor?.All;
+ return Style?.Progress?.BackgroundColor?.All;
}
set
{
- //CreateProgressImageAttributes();
- if (null == Style.Progress.BackgroundColor)
+ if (null != Style?.Progress)
{
- Style.Progress.BackgroundColor = new ColorSelector();
+ Style.Progress.BackgroundColor = value;
}
- Style.Progress.BackgroundColor.All = value;
- //RelayoutRequest();
}
}
{
get
{
- return Style.Buffer?.BackgroundColor?.All;
+ return Style?.Buffer?.BackgroundColor?.All;
}
set
{
- //CreateBufferImageAttributes();
- if (null == Style.Buffer.BackgroundColor)
+ if (null != Style?.Buffer)
{
- Style.Buffer.BackgroundColor = new ColorSelector();
+ Style.Buffer.BackgroundColor = value;
}
- Style.Buffer.BackgroundColor.All = value;
- //RelayoutRequest();
}
}
{
get
{
- if (Style.Thumb.Size == null)
- {
- Style.Thumb.Size = new Size();
- }
- return Style.Thumb.Size;
+ return Style?.Thumb?.Size;
}
set
{
- if (Style.Thumb.Size == null)
- {
- Style.Thumb.Size = new Size();
- }
- if (thumbImage != null)
+ if (null != Style?.Thumb)
{
- Style.Thumb.Size.Width = value.Width;
- Style.Thumb.Size.Height = value.Height;
+ Style.Thumb.Size = value;
RelayoutRequest();
}
}
{
get
{
- return Style.Track.ResourceUrl.All;
+ return Style?.Track?.ResourceUrl?.All;
}
set
{
- if (trackImage != null)
+ if (null != Style?.Track)
{
- if (Style.Track.ResourceUrl == null)
- {
- Style.Track.ResourceUrl = new StringSelector();
- }
- Style.Track.ResourceUrl.All = value;
+ Style.Track.ResourceUrl = value;
+ RelayoutRequest();
}
- RelayoutRequest();
}
}
{
get
{
- return Style.Track.BackgroundColor?.All;
+ return Style?.Track?.BackgroundColor?.All;
}
set
{
- if (Style.Track.BackgroundColor == null)
+ if (null != Style?.Track)
{
- Style.Track.BackgroundColor = new ColorSelector { All = value };
- }
- else
- {
- Style.Track.BackgroundColor.All = value;
+ Style.Track.BackgroundColor = value;
+ RelayoutRequest();
}
- RelayoutRequest();
}
}
{
get
{
- return Style.Thumb.BackgroundColor?.All;
+ return Style?.Thumb?.BackgroundColor?.All;
}
set
{
- if(Style.Thumb.BackgroundColor == null)
+ if(null != Style?.Thumb)
{
- Style.Thumb.BackgroundColor = new ColorSelector { All = value };
- }
- else
- {
- Style.Thumb.BackgroundColor.All = value;
+ Style.Thumb.BackgroundColor = value;
+ RelayoutRequest();
}
- RelayoutRequest();
}
}
[EditorBrowsable(EditorBrowsableState.Never)]
protected override void OnThemeChangedEvent(object sender, StyleManager.ThemeChangeEventArgs e)
{
- SelectButtonStyle tempAttributes = StyleManager.Instance.GetAttributes(style) as SelectButtonStyle;
- if (tempAttributes != null)
+ SelectButtonStyle selectButtonStyle = StyleManager.Instance.GetAttributes(style) as SelectButtonStyle;
+ if (null != selectButtonStyle)
{
- Style.CopyFrom(tempAttributes);
+ Style?.CopyFrom(selectButtonStyle);
UpdateUIContent();
}
}
private void Initialize()
{
- if (selectableImage == null)
+ if (null == Style) return;
+ if (null == selectableImage)
{
selectableImage = new ImageControl();
selectableImage.Name = "SelectableImage";
selectableImage.RaiseToTop();
}
+ if (null == Style.SelectableImage)
+ {
+ Style.SelectableImage = new ImageControlStyle();
+ }
Style.SelectableImage.PositionUsesPivotPoint = true;
- Style.SelectableImage.ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft;
- Style.SelectableImage.PivotPoint = Tizen.NUI.PivotPoint.TopLeft;
+ Style.SelectableImage.ParentOrigin = NUI.ParentOrigin.TopLeft;
+ Style.SelectableImage.PivotPoint = NUI.PivotPoint.TopLeft;
Style.IsSelectable = true;
LayoutDirectionChanged += SelectButtonLayoutDirectionChanged;
private void UpdateTextAttributes()
{
- if (Style.Text != null)
+ if (null == Style) return;
+ if (null == selectableImage) return;
+ if (null != Style.Text)
{
Style.Text.PositionUsesPivotPoint = true;
- Style.Text.ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft;
- Style.Text.PivotPoint = Tizen.NUI.PivotPoint.TopLeft;
+ Style.Text.ParentOrigin = NUI.ParentOrigin.TopLeft;
+ Style.Text.PivotPoint = NUI.PivotPoint.TopLeft;
Style.Text.WidthResizePolicy = ResizePolicyType.Fixed;
Style.Text.HeightResizePolicy = ResizePolicyType.Fixed;
int iconWidth = (int)selectableImage.SizeWidth;
- int textPaddingLeft = Style.Text.Padding.Start;
- int textPaddingRight = Style.Text.Padding.End;
+ int textPaddingLeft = Style.Text.Padding?.Start ?? 0;
+ int textPaddingRight = Style.Text.Padding?.End ?? 0;
+ int imagePaddingStart = selectableImage.Padding?.Start ?? 0;
+ int imagePaddingEnd = selectableImage.Padding?.End ?? 0;
- if(Style.Text.Size == null)
+ if (null == Style.Text.Size && null != Size2D)
{
- Style.Text.Size = new Size(Size2D.Width - iconWidth - selectableImage.Padding.Start - selectableImage.Padding.End - textPaddingLeft - textPaddingRight, Size2D.Height);
+ Style.Text.Size = new Size(Size2D.Width - iconWidth - imagePaddingStart - imagePaddingEnd - textPaddingLeft - textPaddingRight, Size2D.Height);
}
- if(Style.Text.Position == null)
+ if(null == Style.Text.Position)
{
- Style.Text.Position = new Position(selectableImage.Padding.Start + iconWidth + selectableImage.Padding.End + textPaddingLeft, 0);
+ Style.Text.Position = new Position(imagePaddingStart + iconWidth + imagePaddingEnd + textPaddingLeft, 0);
}
Style.Text.VerticalAlignment = VerticalAlignment.Center;
private void SelectButtonLayoutDirectionChanged(object sender, LayoutDirectionChangedEventArgs e)
{
- if (Style == null || Style.Text == null)
- {
- return;
- }
+ if (null == Style || null == Style.Text) return;
+ if (null == selectableImage) return;
UpdateTextAttributes();
int iconWidth = (int)selectableImage.SizeWidth;
- int textPaddingLeft = Style.Text.Padding.Start;
- int textPaddingRight = Style.Text.Padding.End;
+ int textPaddingLeft = Style.Text.Padding?.Start ?? 0;
+ int textPaddingRight = Style.Text.Padding?.End ?? 0;
int pos = 0;
+ int sizeWidth = (int)(Style.Text.Size?.Width ?? 0);
+ if (null == Style.Text.Position)
+ {
+ Style.Text.Position = new Position(0, 0, 0);
+ }
if (LayoutDirection == ViewLayoutDirectionType.RTL)
{
Style.Text.HorizontalAlignment = HorizontalAlignment.End;
+
Style.Text.Position.X = textPaddingRight;
- pos = (int)(Style.Text.Size.Width) + textPaddingLeft + textPaddingRight;
- if (Style.Icon.Padding != null)
- {
+ pos = sizeWidth + textPaddingLeft + textPaddingRight;
+ if (null != Style.Icon?.Padding)
+ {
pos += Style.Icon.Padding.End;
- }
-
+ }
}
else if (LayoutDirection == ViewLayoutDirectionType.LTR)
{
Style.Text.HorizontalAlignment = HorizontalAlignment.Begin;
Style.Text.Position.X = iconWidth + textPaddingLeft;
- if (Style.Icon.Padding != null)
+ if (null != Style.Icon?.Padding)
{
Style.Text.Position.X += (Style.Icon.Padding.Start + Style.Icon.Padding.End);
pos = Style.Icon.Padding.Start;
}
}
-
+ if (null == selectableImage.Position2D)
+ {
+ selectableImage.Position2D = new Position2D(0, 0);
+ }
selectableImage.Position2D.X = pos;
}
{
get
{
- return Style.Thumb?.ResourceUrl?.All;
+ return Style?.Thumb?.ResourceUrl?.All;
}
set
{
- if (Style.Thumb.ResourceUrl == null)
+ if (null != Style?.Thumb)
{
- Style.Thumb.ResourceUrl = new StringSelector();
+ Style.Thumb.ResourceUrl = value;
}
- Style.Thumb.ResourceUrl.All = value;
}
}
{
get
{
- return (StringSelector)Style.Thumb?.ResourceUrl;
+ return (StringSelector)Style?.Thumb?.ResourceUrl;
}
set
{
- if (value != null)
+ if (null != value && null != Style?.Thumb)
{
Style.Thumb.ResourceUrl = value.Clone() as StringSelector;
}
{
get
{
- return Style.Track?.BackgroundColor?.All;
+ return Style?.Track?.BackgroundColor?.All;
}
set
{
- if (Style.Track.BackgroundColor == null)
+ if (null != Style?.Track)
{
- Style.Track.BackgroundColor = new ColorSelector();
+ Style.Track.BackgroundColor = value;
}
- Style.Track.BackgroundColor.All = value;
}
}
{
get
{
- return Style.Progress?.BackgroundColor?.All;
+ return Style?.Progress?.BackgroundColor?.All;
}
set
{
- if (Style.Progress.BackgroundColor == null)
+ if (null != Style?.Progress)
{
- Style.Progress.BackgroundColor = new ColorSelector();
+ Style.Progress.BackgroundColor = value;
}
- Style.Progress.BackgroundColor.All = value;
}
}
{
get
{
- return Style.LowIndicatorImage?.ResourceUrl?.All;
+ return Style?.LowIndicatorImage?.ResourceUrl?.All;
}
set
{
- if (Style.LowIndicatorImage.ResourceUrl == null)
+ if (null != Style?.LowIndicatorImage)
{
- Style.LowIndicatorImage.ResourceUrl = new StringSelector();
+ Style.LowIndicatorImage.ResourceUrl = value;
}
- Style.LowIndicatorImage.ResourceUrl.All = value;
}
}
{
get
{
- return Style.HighIndicatorImage?.ResourceUrl?.All;
+ return Style?.HighIndicatorImage?.ResourceUrl?.All;
}
set
{
- if (Style.HighIndicatorImage.ResourceUrl == null)
+ if (null != Style?.HighIndicatorImage)
{
- Style.HighIndicatorImage.ResourceUrl = new StringSelector();
+ Style.HighIndicatorImage.ResourceUrl = value;
}
- Style.HighIndicatorImage.ResourceUrl.All = value;
}
}
{
get
{
- return Style.LowIndicator?.Text?.All;
+ return Style?.LowIndicator?.Text?.All;
}
set
{
- if (Style.LowIndicator.Text == null)
+ if (null != Style?.LowIndicator)
{
- Style.LowIndicator.Text = new StringSelector();
+ Style.LowIndicator.Text= value;
}
- Style.LowIndicator.Text.All = value;
}
}
{
get
{
- return Style.HighIndicator?.Text?.All;
+ return Style?.HighIndicator?.Text?.All;
}
set
{
- if (Style.HighIndicator.Text == null)
+ if (null != Style?.HighIndicator)
{
- Style.HighIndicator.Text = new StringSelector();
+ Style.HighIndicator.Text = value;
}
- Style.HighIndicator.Text.All = value;
}
}
{
get
{
- return Style.Track?.ResourceUrl?.All;
+ return Style?.Track?.ResourceUrl?.All;
}
set
{
- if (value != null)
+ if (null != value && null != Style?.Track)
{
- if (Style.Track.ResourceUrl == null)
- {
- Style.Track.ResourceUrl = new StringSelector();
- }
- Style.Track.ResourceUrl.All = value;
+ Style.Track.ResourceUrl = value;
}
}
}
{
get
{
- return (StringSelector)Style.Track?.ResourceUrl;
+ return (StringSelector)Style?.Track?.ResourceUrl;
}
set
{
- if (value != null)
+ if (null != value && null != Style?.Track)
{
Style.Track.ResourceUrl = value.Clone() as StringSelector;
}
{
get
{
- return Style.Thumb?.ResourceUrl?.All;
+ return Style?.Thumb?.ResourceUrl?.All;
}
set
{
- if (value != null)
+ if (null != value && null != Style?.Thumb)
{
- if (Style.Thumb.ResourceUrl == null)
- {
- Style.Thumb.ResourceUrl = new StringSelector();
- }
- Style.Thumb.ResourceUrl.All = value;
+ Style.Thumb.ResourceUrl = value;
}
}
}
{
get
{
- return (StringSelector)Style.Thumb?.ResourceUrl;
+ return (StringSelector)Style?.Thumb?.ResourceUrl;
}
set
{
- if (value != null)
+ if (null != value && null != Style?.Thumb)
{
Style.Thumb.ResourceUrl = value.Clone() as StringSelector;
}
{
get
{
- return Style.Thumb?.Size ?? new Size(0, 0);
+ return Style?.Thumb?.Size;
}
set
{
- Style.Thumb.Size = value;
+ if (null != Style?.Thumb)
+ {
+ Style.Thumb.Size = value;
+ }
}
}
{
get
{
- return Style.UseTextNaturalSize;
+ return Style?.UseTextNaturalSize ?? false;
}
set
{
- Style.UseTextNaturalSize = value;
- RelayoutRequest();
+ if (null != Style)
+ {
+ Style.UseTextNaturalSize = value;
+ RelayoutRequest();
+ }
}
}
{
get
{
- return Style.ItemSpace;
+ return Style?.ItemSpace ?? 0;
}
set
{
- Style.ItemSpace = value;
- RelayoutRequest();
+ if (null != Style)
+ {
+ Style.ItemSpace = value;
+ RelayoutRequest();
+ }
}
}
}
set
{
- if(null != value)
+ if(null != value && null != Style?.ItemPadding)
{
Style.ItemPadding.CopyFrom(value);
{
get
{
- return Style.UnderLine?.Size;
+ return Style?.UnderLine?.Size;
}
set
{
- if (value != null)
+ if (null != Style?.UnderLine)
{
- //CreateUnderLineAttributes();
Style.UnderLine.Size = value;
- //RelayoutRequest();
}
}
}
{
get
{
- return Style.UnderLine?.BackgroundColor?.All;
+ return Style?.UnderLine?.BackgroundColor?.All;
}
set
{
- if (value != null)
+ if (null != Style?.UnderLine)
{
- //CreateUnderLineAttributes();
- if (Style.UnderLine.BackgroundColor == null)
- {
- Style.UnderLine.BackgroundColor = new ColorSelector();
- }
- Style.UnderLine.BackgroundColor.All = value;
- //RelayoutRequest();
+ Style.UnderLine.BackgroundColor = value;
}
}
}
{
get
{
- return Style.Text?.PointSize?.All ?? 0;
+ return Style?.Text?.PointSize?.All ?? 0;
}
set
{
- //CreateTextAttributes();
- if (Style.Text.PointSize == null)
+ if (null != Style?.Text)
{
- Style.Text.PointSize = new FloatSelector();
+ Style.Text.PointSize = value;
}
- Style.Text.PointSize.All = value;
- //RelayoutRequest();
}
}
{
get
{
- return Style.Text?.FontFamily.All;
+ return Style?.Text?.FontFamily?.All;
}
set
{
- //CreateTextAttributes();
- Style.Text.FontFamily.All = value;
- //RelayoutRequest();
+ if (null != Style?.Text)
+ {
+ Style.Text.FontFamily = value;
+ }
}
}
{
get
{
- return Style.Text?.TextColor?.All;
+ return Style?.Text?.TextColor?.All;
}
set
{
- //CreateTextAttributes();
- if (Style.Text.TextColor == null)
+ if (null != Style?.Text)
{
- Style.Text.TextColor = new ColorSelector();
+ Style.Text.TextColor = value;
}
- Style.Text.TextColor.All = value;
- //RelayoutRequest();
}
}
{
get
{
- return (ColorSelector)Style.Text.TextColor;
+ return (ColorSelector)Style?.Text?.TextColor;
}
set
{
- if (value != null)
+ if (null != value && null != Style?.Text)
{
- //CreateTextAttributes();
Style.Text.TextColor = value.Clone() as ColorSelector;
- //RelayoutRequest();
}
}
}
{
get
{
- return (float)Style.Text?.PointSize?.All;
+ return (float)Style?.Text?.PointSize?.All;
}
set
{
- if (null == Style.Text.PointSize)
+ if (null != Style?.Text)
{
- Style.Text.PointSize = new FloatSelector();
+ Style.Text.PointSize = value;
}
- Style.Text.PointSize.All = value;
}
}
{
get
{
- return Style.Text?.FontFamily.All;
+ return Style?.Text?.FontFamily?.All;
}
set
{
- Style.Text.FontFamily = value;
+ if (null != Style?.Text)
+ {
+ Style.Text.FontFamily = value;
+ }
}
}
{
get
{
- return Style.Text?.TextColor?.All;
+ return Style?.Text?.TextColor?.All;
}
set
{
- //CreateTextAttributes();
- if (null == Style.Text.TextColor)
+ if (null != Style?.Text)
{
- Style.Text.TextColor = new ColorSelector();
+ Style.Text.TextColor = value;
}
- Style.Text.TextColor.All = value;
- //RelayoutRequest();
}
}
{
get
{
- return Style.Text?.HorizontalAlignment ?? HorizontalAlignment.Center;
+ return Style?.Text?.HorizontalAlignment ?? HorizontalAlignment.Center;
}
set
{
- //CreateTextAttributes();
- Style.Text.HorizontalAlignment = value;
- //RelayoutRequest();
+ if (null != Style?.Text)
+ {
+ Style.Text.HorizontalAlignment = value;
+ }
}
}