/// <summary> /// Theme change callback when theme is changed, this callback will be trigger. /// </summary> /// <param name="sender">The sender</param> /// <param name="e">The event data</param> /// <since_tizen> 8 </since_tizen> protected override void OnThemeChangedEvent(object sender, StyleManager.ThemeChangeEventArgs e) { SwitchStyle switchStyle = StyleManager.Instance.GetViewStyle(style) as SwitchStyle; if (null != switchStyle) { Style.CopyFrom(switchStyle); } }
/// <summary> /// Creates a new instance of a SwitchStyle with style. /// </summary> /// <param name="style">Create SwitchStyle by style customized by user.</param> /// <since_tizen> 8 </since_tizen> public SwitchStyle(SwitchStyle style) : base(style) { if(null == style) { return; } InitSubStyle(); this.CopyFrom(style); }
/// <summary> /// Creates a new instance of a SwitchStyle with style. /// </summary> /// <param name="style">Create SwitchStyle by style customized by user.</param> /// <since_tizen> 8 </since_tizen> public SwitchStyle(SwitchStyle style) : base(style) { if (null == style) { return; } IsSelectable = true; Track = new ImageViewStyle(); Thumb = new ImageViewStyle(); this.CopyFrom(style); }
/// <summary> /// Return default Switch style /// </summary> internal protected override ViewStyle GetViewStyle() { SwitchStyle style = new SwitchStyle { Size = new Size(96, 60), Track = new ImageViewStyle { ResourceUrl = new Selector <string> { Normal = DefaultStyle.GetResourcePath("nui_component_default_switch_track_n.png"), Selected = DefaultStyle.GetResourcePath("nui_component_default_switch_track_s.png"), Disabled = DefaultStyle.GetResourcePath("nui_component_default_switch_track_d.png"), DisabledSelected = DefaultStyle.GetResourcePath("nui_component_default_switch_track_ds.png"), } }, Thumb = new ImageViewStyle { WidthResizePolicy = ResizePolicyType.DimensionDependency, HeightResizePolicy = ResizePolicyType.SizeRelativeToParent, SizeModeFactor = new Vector3(1, 1, 1), ResourceUrl = new Selector <string> { Normal = DefaultStyle.GetResourcePath("nui_component_default_switch_thumb_n.png"), Selected = DefaultStyle.GetResourcePath("nui_component_default_switch_thumb_n.png"), Disabled = DefaultStyle.GetResourcePath("nui_component_default_switch_thumb_d.png"), DisabledSelected = DefaultStyle.GetResourcePath("nui_component_default_switch_thumb_d.png"), }, }, Text = new TextLabelStyle { PointSize = new Selector <float?> { All = DefaultStyle.PointSizeNormal }, WidthResizePolicy = ResizePolicyType.FillToParent, HeightResizePolicy = ResizePolicyType.FillToParent, HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, TextColor = new Selector <Color> { Normal = new Color(0.22f, 0.22f, 0.22f, 1), Pressed = new Color(0.11f, 0.11f, 0.11f, 1), Disabled = new Color(0.66f, 0.66f, 0.66f, 1) } }, }; return(style); }
public override void ApplyStyle(ViewStyle viewStyle) { base.ApplyStyle(viewStyle); SwitchStyle swStyle = viewStyle as SwitchStyle; if (null != swStyle) { if (swStyle.Track != null) { Track.ApplyStyle(swStyle.Track); } if (swStyle.Thumb != null) { Thumb.ApplyStyle(swStyle.Thumb); } } }
/// <summary> /// Style's clone function. /// </summary> /// <param name="bindableObject">The style that need to copy.</param> /// <since_tizen> 8 </since_tizen> public override void CopyFrom(BindableObject bindableObject) { base.CopyFrom(bindableObject); SwitchStyle switchStyle = bindableObject as SwitchStyle; if (null != switchStyle) { if (null != switchStyle.Track) { Track?.CopyFrom(switchStyle.Track); } if (null != switchStyle.Thumb) { Thumb?.CopyFrom(switchStyle.Thumb); } } }
/// <summary> /// Creates a new instance of a Switch with style. /// </summary> /// <param name="switchStyle">Create Switch by style customized by user.</param> /// <since_tizen> 8 </since_tizen> public Switch(SwitchStyle switchStyle) : base(switchStyle) { Initialize(); }
/// <summary> /// Creates a new instance of a Switch with style. /// </summary> /// <param name="switchStyle">Create Switch by style customized by user.</param> /// <since_tizen> 8 </since_tizen> public Switch(SwitchStyle switchStyle) : base(switchStyle) { }
/// <summary> /// Creates a new instance of a SwitchStyle with style. /// </summary> /// <param name="style">Create SwitchStyle by style customized by user.</param> /// <since_tizen> 8 </since_tizen> public SwitchStyle(SwitchStyle style) : base(style) { }