diff --git a/src/HotUI/Binding.cs b/src/HotUI/Binding.cs index 1b188b96..c6155666 100644 --- a/src/HotUI/Binding.cs +++ b/src/HotUI/Binding.cs @@ -2,7 +2,7 @@ using System; namespace HotUI { - public class Binding + public class Binding : IBinding { public Binding(Func getValue, Action setValue) { @@ -12,10 +12,11 @@ namespace HotUI public Func Get { get; } public Action Set { get; } - public bool Implicit { get; set; } + + public bool ImplicitFromValue { get; set; } public static implicit operator Binding(T value) => new Binding( getValue:() => value, - setValue: null) { Implicit = true }; + setValue: null) { ImplicitFromValue = true }; } } \ No newline at end of file diff --git a/src/HotUI/Controls/Slider.cs b/src/HotUI/Controls/Slider.cs index 3755bdfa..0b09224c 100644 --- a/src/HotUI/Controls/Slider.cs +++ b/src/HotUI/Controls/Slider.cs @@ -5,11 +5,11 @@ namespace HotUI public class Slider : View { public Slider ( - Binding value = null, + Binding value = null, float from = 0, float through = 100, float by = 1, - Action onEditingChanged = null) : base(value?.Implicit ?? false) + Action onEditingChanged = null) : base(value) { ValueBinding = value?.Get; From = from; diff --git a/src/HotUI/Controls/View.cs b/src/HotUI/Controls/View.cs index bbe4e5e1..2166f73d 100644 --- a/src/HotUI/Controls/View.cs +++ b/src/HotUI/Controls/View.cs @@ -40,6 +40,12 @@ namespace HotUI { } public NavigationView Navigation { get; set; } protected State State { get; set; } + + protected View(IBinding binding) : this(binding?.ImplicitFromValue ?? false) + { + + } + public View (bool hasConstructors) { ActiveViews.Add (this); diff --git a/src/HotUI/IBinding.cs b/src/HotUI/IBinding.cs new file mode 100644 index 00000000..2c53f643 --- /dev/null +++ b/src/HotUI/IBinding.cs @@ -0,0 +1,7 @@ +namespace HotUI +{ + public interface IBinding + { + bool ImplicitFromValue { get; set; } + } +} \ No newline at end of file