diff --git a/demo/UraniumApp/Pages/ValidationsPage.xaml b/demo/UraniumApp/Pages/ValidationsPage.xaml
index 7ef30c18..f3838f24 100644
--- a/demo/UraniumApp/Pages/ValidationsPage.xaml
+++ b/demo/UraniumApp/Pages/ValidationsPage.xaml
@@ -16,14 +16,14 @@
-
-
@@ -43,13 +43,13 @@
-
-
-
@@ -57,7 +57,7 @@
-
@@ -77,6 +77,10 @@
+
+
diff --git a/demo/UraniumApp/ViewModels/ValidationsPageViewModel.cs b/demo/UraniumApp/ViewModels/ValidationsPageViewModel.cs
index 306fef65..0eed72ed 100644
--- a/demo/UraniumApp/ViewModels/ValidationsPageViewModel.cs
+++ b/demo/UraniumApp/ViewModels/ValidationsPageViewModel.cs
@@ -13,10 +13,10 @@ public class ValidationsPageViewModel : UraniumBindableObject
{
private string email = string.Empty;
private string fullName = string.Empty;
- private Gender gender;
+ private Gender? gender;
private DateTime? birthDate;
private TimeSpan? meetingTime;
- private int numberOfSeats;
+ private int? numberOfSeats;
private bool isTermsAndConditionsAccepted;
public ValidationsPageViewModel()
@@ -46,18 +46,31 @@ public ValidationsPageViewModel()
NumberOfSeats = default;
IsTermsAndConditionsAccepted = default;
});
+
+ FillCommand = new Command(() =>
+ {
+ Email = "a@b.c";
+ FullName = "Full Name";
+ Gender = ViewModels.Gender.Male;
+ BirthDate = DateTime.UtcNow.AddYears(-26);
+ MeetingTime = new TimeSpan(10,00,00);
+ NumberOfSeats = 2;
+ IsTermsAndConditionsAccepted = true;
+ });
}
public ICommand SubmitCommand { get; set; }
public ICommand ClearCommand { get; set; }
+ public ICommand FillCommand { get; set; }
+
public string Email { get => email; set => SetProperty(ref email, value); }
public string FullName { get => fullName; set => SetProperty(ref fullName, value); }
- public Gender Gender { get => gender; set => SetProperty(ref gender, value); }
+ public Gender? Gender { get => gender; set => SetProperty(ref gender, value); }
public DateTime? BirthDate { get => birthDate; set => SetProperty(ref birthDate, value); }
public TimeSpan? MeetingTime { get => meetingTime; set => SetProperty(ref meetingTime, value); }
- public int NumberOfSeats { get => numberOfSeats; set => SetProperty(ref numberOfSeats, value); }
+ public int? NumberOfSeats { get => numberOfSeats; set => SetProperty(ref numberOfSeats, value); }
public bool IsTermsAndConditionsAccepted { get => isTermsAndConditionsAccepted; set => SetProperty(ref isTermsAndConditionsAccepted, value); }
}
public enum Gender
diff --git a/docs/en/docs-nav.json b/docs/en/docs-nav.json
index 58c34717..74f64a3b 100644
--- a/docs/en/docs-nav.json
+++ b/docs/en/docs-nav.json
@@ -105,6 +105,16 @@
}
]
},
+ {
+ "text": "Migration Guide",
+ "items":[
+ {
+ "text": "Migration to v1.1",
+ "path": "migration-guides/Migrating-To-1.1.md"
+ }
+ ]
+ ]
+ },
{
"text": "Support",
"path": "Support.md",
diff --git a/docs/en/migration-guides/Migrating-To-1.1.md b/docs/en/migration-guides/Migrating-To-1.1.md
new file mode 100644
index 00000000..926ec298
--- /dev/null
+++ b/docs/en/migration-guides/Migrating-To-1.1.md
@@ -0,0 +1,104 @@
+# Migration Guide to v1.1
+Version 1.1 comes with some changes. You should follow this docuemnt to migrate your code to the new version properly.
+
+## Changes
+
+### Disabled States
+Each input has a disabled state now. It's working well after updating to v1.1. But you should add following style to your resources if you overrided the default style.
+
+- Add following section in your StyleOverride file if you are using StyleOverride.
+```xml
+
+
+
+```
+
+- Find input:CheckBox in your StyleOverride file and update CheckBox styles like following. _(**VisualStateManager.VisualStateGroups** should be added.)_
+```xml
+
+
+```
+
+- Find input:RadioButton in your StyleOverride file and update RadioButton styles like following. _(**VisualStateManager.VisualStateGroups** should be added.)_
+```xml
+
+```
+> _**Note**: If you're not sure about it, you can back-up your custom styles and re-add styles with `dotnet new uranium-material-resources -n MaterialOverride` command._
+
+
diff --git a/src/UraniumUI.Material/Controls/CheckBox.cs b/src/UraniumUI.Material/Controls/CheckBox.cs
index 8a3e51f5..accdd17d 100644
--- a/src/UraniumUI.Material/Controls/CheckBox.cs
+++ b/src/UraniumUI.Material/Controls/CheckBox.cs
@@ -5,6 +5,5 @@ public class CheckBox : InputKit.Shared.Controls.CheckBox
{
public CheckBox()
{
-
}
}
diff --git a/src/UraniumUI.Material/Controls/DatePickerField.cs b/src/UraniumUI.Material/Controls/DatePickerField.cs
index d5b8a9c8..f09a9141 100644
--- a/src/UraniumUI.Material/Controls/DatePickerField.cs
+++ b/src/UraniumUI.Material/Controls/DatePickerField.cs
@@ -45,6 +45,7 @@ public DatePickerField()
endIconsContainer.Add(iconClear);
DatePickerView.SetBinding(DatePickerView.DateProperty, new Binding(nameof(Date), source: this));
+ DatePickerView.SetBinding(DatePickerView.IsEnabledProperty, new Binding(nameof(IsEnabled), source: this));
#if MACCATALYST
labelTitle.InputTransparent = false;
diff --git a/src/UraniumUI.Material/Controls/PickerField.cs b/src/UraniumUI.Material/Controls/PickerField.cs
index e6a00ede..86ffc7d7 100644
--- a/src/UraniumUI.Material/Controls/PickerField.cs
+++ b/src/UraniumUI.Material/Controls/PickerField.cs
@@ -10,151 +10,155 @@ namespace UraniumUI.Material.Controls;
[ContentProperty(nameof(Validations))]
public class PickerField : InputField
{
- public PickerView PickerView => Content as PickerView;
+ public PickerView PickerView => Content as PickerView;
- public override View Content { get; set; } = new PickerView
- {
- VerticalOptions = LayoutOptions.Center,
- Margin = new Thickness(10, 0),
+ public override View Content { get; set; } = new PickerView
+ {
+ VerticalOptions = LayoutOptions.Center,
+ Margin = new Thickness(10, 0),
#if WINDOWS
- Opacity = 0,
+ Opacity = 0,
#endif
- };
+ };
#if WINDOWS
- Label labelSelectedItem = new Label
- {
- InputTransparent = true,
- HorizontalOptions = LayoutOptions.Start,
- VerticalOptions = LayoutOptions.Center,
- TextColor = ColorResource.GetColor("OnBackground", "OnBackgroundDark", Colors.Gray)
- };
+ Label labelSelectedItem = new Label
+ {
+ InputTransparent = true,
+ HorizontalOptions = LayoutOptions.Start,
+ VerticalOptions = LayoutOptions.Center,
+ TextColor = ColorResource.GetColor("OnBackground", "OnBackgroundDark", Colors.Gray)
+ };
#endif
- protected ContentView iconClear = new ContentView
- {
- VerticalOptions = LayoutOptions.Center,
- HorizontalOptions = LayoutOptions.End,
- IsVisible = false,
- Padding = 10,
- Content = new Path
- {
- Data = UraniumShapes.X,
- Fill = ColorResource.GetColor("OnBackground", "OnBackgroundDark", Colors.DarkGray).WithAlpha(.5f),
- }
- };
-
- public override bool HasValue => SelectedItem != null;
-
- public PickerField()
- {
- var clearGestureRecognizer = new TapGestureRecognizer();
- clearGestureRecognizer.Tapped += OnClearTapped;
- iconClear.GestureRecognizers.Add(clearGestureRecognizer);
-
- endIconsContainer.Add(iconClear);
-
- PickerView.SetBinding(PickerView.SelectedItemProperty, new Binding(nameof(SelectedItem), source: this));
- PickerView.SetBinding(PickerView.SelectedIndexProperty, new Binding(nameof(SelectedIndex), source: this));
+ protected ContentView iconClear = new ContentView
+ {
+ VerticalOptions = LayoutOptions.Center,
+ HorizontalOptions = LayoutOptions.End,
+ IsVisible = false,
+ Padding = 10,
+ Content = new Path
+ {
+ Data = UraniumShapes.X,
+ Fill = ColorResource.GetColor("OnBackground", "OnBackgroundDark", Colors.DarkGray).WithAlpha(.5f),
+ }
+ };
+
+ public override bool HasValue => SelectedItem != null;
+
+ public PickerField()
+ {
+ var clearGestureRecognizer = new TapGestureRecognizer();
+ clearGestureRecognizer.Tapped += OnClearTapped;
+ iconClear.GestureRecognizers.Add(clearGestureRecognizer);
+
+ endIconsContainer.Add(iconClear);
+
+ PickerView.SetBinding(PickerView.SelectedItemProperty, new Binding(nameof(SelectedItem), source: this));
+ PickerView.SetBinding(PickerView.SelectedIndexProperty, new Binding(nameof(SelectedIndex), source: this));
+ PickerView.SetBinding(PickerView.IsEnabledProperty, new Binding(nameof(IsEnabled), source: this));
#if WINDOWS
- rootGrid.Add(labelSelectedItem, column: 1);
+ rootGrid.Add(labelSelectedItem, column: 1);
#endif
- }
+ }
- protected override object GetValueForValidator()
- {
- return SelectedItem;
- }
+ protected override object GetValueForValidator()
+ {
+ return SelectedItem;
+ }
- protected void OnClearTapped(object sender, EventArgs e)
- {
- SelectedItem = null;
- PickerView.Unfocus();
- }
+ protected void OnClearTapped(object sender, EventArgs e)
+ {
+ if (IsEnabled)
+ {
+ SelectedItem = null;
+ PickerView.Unfocus();
+ }
+ }
- protected virtual void OnSelectedItemChanged()
- {
- OnPropertyChanged(nameof(SelectedItem));
- CheckAndShowValidations();
+ protected virtual void OnSelectedItemChanged()
+ {
+ OnPropertyChanged(nameof(SelectedItem));
+ CheckAndShowValidations();
- iconClear.IsVisible = SelectedItem != null;
+ iconClear.IsVisible = SelectedItem != null;
#if WINDOWS
- labelSelectedItem.Text = SelectedItem?.ToString();
+ labelSelectedItem.Text = SelectedItem?.ToString();
#endif
- UpdateState();
- }
+ UpdateState();
+ }
- protected override void UpdateState(bool animate = true)
- {
- base.UpdateState(animate);
- }
+ protected override void UpdateState(bool animate = true)
+ {
+ base.UpdateState(animate);
+ }
- public IList Items => PickerView.Items;
+ public IList Items => PickerView.Items;
- public object SelectedItem { get => GetValue(SelectedItemProperty); set => SetValue(SelectedItemProperty, value); }
+ public object SelectedItem { get => GetValue(SelectedItemProperty); set => SetValue(SelectedItemProperty, value); }
- public static readonly BindableProperty SelectedItemProperty = BindableProperty.Create(
- nameof(SelectedItem), typeof(object), typeof(PickerField),
- defaultValue: Picker.SelectedItemProperty.DefaultValue,
- defaultBindingMode: BindingMode.TwoWay,
- propertyChanged: (bindable, oldValue, newValue) => (bindable as PickerField).OnSelectedItemChanged());
+ public static readonly BindableProperty SelectedItemProperty = BindableProperty.Create(
+ nameof(SelectedItem), typeof(object), typeof(PickerField),
+ defaultValue: Picker.SelectedItemProperty.DefaultValue,
+ defaultBindingMode: BindingMode.TwoWay,
+ propertyChanged: (bindable, oldValue, newValue) => (bindable as PickerField).OnSelectedItemChanged());
- public int SelectedIndex { get => (int)GetValue(SelectedIndexProperty); set => SetValue(SelectedIndexProperty, value); }
+ public int SelectedIndex { get => (int)GetValue(SelectedIndexProperty); set => SetValue(SelectedIndexProperty, value); }
- public static readonly BindableProperty SelectedIndexProperty = BindableProperty.Create(
- nameof(SelectedIndex), typeof(int), typeof(PickerField),
- defaultValue: Picker.SelectedIndexProperty.DefaultValue,
- defaultBindingMode: BindingMode.TwoWay,
- propertyChanged: (bindable, oldValue, newValue) => (bindable as PickerField).OnPropertyChanged(nameof(SelectedIndex)));
+ public static readonly BindableProperty SelectedIndexProperty = BindableProperty.Create(
+ nameof(SelectedIndex), typeof(int), typeof(PickerField),
+ defaultValue: Picker.SelectedIndexProperty.DefaultValue,
+ defaultBindingMode: BindingMode.TwoWay,
+ propertyChanged: (bindable, oldValue, newValue) => (bindable as PickerField).OnPropertyChanged(nameof(SelectedIndex)));
- public IList ItemsSource { get => (IList)GetValue(ItemsSourceProperty); set => SetValue(ItemsSourceProperty, value); }
+ public IList ItemsSource { get => (IList)GetValue(ItemsSourceProperty); set => SetValue(ItemsSourceProperty, value); }
- public static readonly BindableProperty ItemsSourceProperty = BindableProperty.Create(
- nameof(ItemsSource), typeof(IList), typeof(PickerField),
- defaultValue: Picker.ItemsSourceProperty.DefaultValue,
- propertyChanged: (bindable, oldValue, newValue) => (bindable as PickerField).PickerView.ItemsSource = (IList)newValue);
+ public static readonly BindableProperty ItemsSourceProperty = BindableProperty.Create(
+ nameof(ItemsSource), typeof(IList), typeof(PickerField),
+ defaultValue: Picker.ItemsSourceProperty.DefaultValue,
+ propertyChanged: (bindable, oldValue, newValue) => (bindable as PickerField).PickerView.ItemsSource = (IList)newValue);
- public BindingBase ItemDisplayBinding { get => PickerView.ItemDisplayBinding; set => PickerView.ItemDisplayBinding = value; }
+ public BindingBase ItemDisplayBinding { get => PickerView.ItemDisplayBinding; set => PickerView.ItemDisplayBinding = value; }
- public FontAttributes FontAttributes { get => (FontAttributes)GetValue(FontAttributesProperty); set => SetValue(FontAttributesProperty, value); }
+ public FontAttributes FontAttributes { get => (FontAttributes)GetValue(FontAttributesProperty); set => SetValue(FontAttributesProperty, value); }
- public static readonly BindableProperty FontAttributesProperty = BindableProperty.Create(
- nameof(FontAttributes), typeof(FontAttributes), typeof(PickerField),
- defaultValue: Picker.FontAttributesProperty.DefaultValue,
- propertyChanged: (bindable, oldValue, newValue) => (bindable as PickerField).PickerView.FontAttributes = (FontAttributes)newValue);
+ public static readonly BindableProperty FontAttributesProperty = BindableProperty.Create(
+ nameof(FontAttributes), typeof(FontAttributes), typeof(PickerField),
+ defaultValue: Picker.FontAttributesProperty.DefaultValue,
+ propertyChanged: (bindable, oldValue, newValue) => (bindable as PickerField).PickerView.FontAttributes = (FontAttributes)newValue);
- public string FontFamily { get => (string)GetValue(FontFamilyProperty); set => SetValue(FontFamilyProperty, value); }
+ public string FontFamily { get => (string)GetValue(FontFamilyProperty); set => SetValue(FontFamilyProperty, value); }
- public static readonly BindableProperty FontFamilyProperty = BindableProperty.Create(
- nameof(FontFamily), typeof(string), typeof(PickerField),
- defaultValue: Picker.FontFamilyProperty.DefaultValue,
- propertyChanged: (bindable, oldValue, newValue) => (bindable as PickerField).PickerView.FontFamily = (string)newValue);
+ public static readonly BindableProperty FontFamilyProperty = BindableProperty.Create(
+ nameof(FontFamily), typeof(string), typeof(PickerField),
+ defaultValue: Picker.FontFamilyProperty.DefaultValue,
+ propertyChanged: (bindable, oldValue, newValue) => (bindable as PickerField).PickerView.FontFamily = (string)newValue);
- [TypeConverter(typeof(FontSizeConverter))]
- public double FontSize { get => (double)GetValue(FontSizeProperty); set => SetValue(FontSizeProperty, value); }
+ [TypeConverter(typeof(FontSizeConverter))]
+ public double FontSize { get => (double)GetValue(FontSizeProperty); set => SetValue(FontSizeProperty, value); }
- public static readonly BindableProperty FontSizeProperty = BindableProperty.Create(
- nameof(FontSize), typeof(double), typeof(PickerField), Picker.FontSizeProperty.DefaultValue,
- propertyChanged: (bindable, oldValue, newValue) => (bindable as PickerField).PickerView.FontSize = (double)newValue);
+ public static readonly BindableProperty FontSizeProperty = BindableProperty.Create(
+ nameof(FontSize), typeof(double), typeof(PickerField), Picker.FontSizeProperty.DefaultValue,
+ propertyChanged: (bindable, oldValue, newValue) => (bindable as PickerField).PickerView.FontSize = (double)newValue);
- public bool FontAutoScalingEnabled { get => (bool)GetValue(FontAutoScalingEnabledProperty); set => SetValue(FontAutoScalingEnabledProperty, value); }
+ public bool FontAutoScalingEnabled { get => (bool)GetValue(FontAutoScalingEnabledProperty); set => SetValue(FontAutoScalingEnabledProperty, value); }
- public static readonly BindableProperty FontAutoScalingEnabledProperty = BindableProperty.Create(
- nameof(FontAutoScalingEnabled), typeof(bool), typeof(PickerField), Picker.FontAutoScalingEnabledProperty.DefaultValue,
- propertyChanged: (bindable, oldValue, newValue) => (bindable as PickerField).PickerView.FontAutoScalingEnabled = (bool)newValue);
+ public static readonly BindableProperty FontAutoScalingEnabledProperty = BindableProperty.Create(
+ nameof(FontAutoScalingEnabled), typeof(bool), typeof(PickerField), Picker.FontAutoScalingEnabledProperty.DefaultValue,
+ propertyChanged: (bindable, oldValue, newValue) => (bindable as PickerField).PickerView.FontAutoScalingEnabled = (bool)newValue);
- public Color TextColor { get => (Color)GetValue(TextColorProperty); set => SetValue(TextColorProperty, value); }
+ public Color TextColor { get => (Color)GetValue(TextColorProperty); set => SetValue(TextColorProperty, value); }
- public static readonly BindableProperty TextColorProperty = BindableProperty.Create(
- nameof(TextColor), typeof(Color), typeof(PickerField), Picker.TextColorProperty.DefaultValue,
- propertyChanged: (bindable, oldValue, newValue) => (bindable as PickerField).PickerView.TextColor = (Color)newValue);
+ public static readonly BindableProperty TextColorProperty = BindableProperty.Create(
+ nameof(TextColor), typeof(Color), typeof(PickerField), Picker.TextColorProperty.DefaultValue,
+ propertyChanged: (bindable, oldValue, newValue) => (bindable as PickerField).PickerView.TextColor = (Color)newValue);
- public double CharacterSpacing { get => (double)GetValue(CharacterSpacingProperty); set => SetValue(CharacterSpacingProperty, value); }
+ public double CharacterSpacing { get => (double)GetValue(CharacterSpacingProperty); set => SetValue(CharacterSpacingProperty, value); }
- public static readonly BindableProperty CharacterSpacingProperty = BindableProperty.Create(
- nameof(CharacterSpacing), typeof(double), typeof(PickerField), Picker.CharacterSpacingProperty.DefaultValue,
- propertyChanged: (bindable, oldValue, newValue) => (bindable as PickerField).PickerView.CharacterSpacing = (double)newValue);
+ public static readonly BindableProperty CharacterSpacingProperty = BindableProperty.Create(
+ nameof(CharacterSpacing), typeof(double), typeof(PickerField), Picker.CharacterSpacingProperty.DefaultValue,
+ propertyChanged: (bindable, oldValue, newValue) => (bindable as PickerField).PickerView.CharacterSpacing = (double)newValue);
}
diff --git a/src/UraniumUI.Material/Controls/TextField.cs b/src/UraniumUI.Material/Controls/TextField.cs
index 4513de81..0396552b 100644
--- a/src/UraniumUI.Material/Controls/TextField.cs
+++ b/src/UraniumUI.Material/Controls/TextField.cs
@@ -23,14 +23,13 @@ public TextField()
EntryView.SetBinding(Entry.ReturnCommandProperty, new Binding(nameof(ReturnCommand), source: this));
EntryView.SetBinding(Entry.SelectionLengthProperty, new Binding(nameof(SelectionLength), source: this));
EntryView.SetBinding(Entry.CursorPositionProperty, new Binding(nameof(CursorPosition), source: this));
-
+ EntryView.SetBinding(Entry.IsEnabledProperty, new Binding(nameof(IsEnabled), source: this));
EntryView.TextChanged += EntryView_TextChanged;
#if WINDOWS
EntryView.HandlerChanged += (s, e) =>
{
var textBox = EntryView.Handler.PlatformView as Microsoft.UI.Xaml.Controls.TextBox;
- Console.WriteLine(EntryView.Handler.PlatformView as Microsoft.UI.Xaml.Controls.TextBox);
textBox.FocusVisualPrimaryThickness = new Microsoft.UI.Xaml.Thickness(0);
textBox.FocusVisualSecondaryThickness = new Microsoft.UI.Xaml.Thickness(0);
diff --git a/src/UraniumUI.Material/Controls/TimePickerField.cs b/src/UraniumUI.Material/Controls/TimePickerField.cs
index bfc21864..ef6cee77 100644
--- a/src/UraniumUI.Material/Controls/TimePickerField.cs
+++ b/src/UraniumUI.Material/Controls/TimePickerField.cs
@@ -58,6 +58,7 @@ public TimePickerField()
});
#endif
TimePickerView.SetBinding(TimePicker.TimeProperty, new Binding(nameof(Time), source: this));
+ TimePickerView.SetBinding(TimePicker.IsEnabledProperty, new Binding(nameof(IsEnabled), source: this));
}
protected override object GetValueForValidator()
diff --git a/src/UraniumUI.Material/Resources/StyleResource.xaml b/src/UraniumUI.Material/Resources/StyleResource.xaml
index 253c075e..ba9cab14 100644
--- a/src/UraniumUI.Material/Resources/StyleResource.xaml
+++ b/src/UraniumUI.Material/Resources/StyleResource.xaml
@@ -58,8 +58,6 @@
-
-
-
-
+
+
+
\ No newline at end of file
diff --git a/templates/default/MyCompany.MyProject/Resources/Styles/MaterialStyleOverride.xaml b/templates/default/MyCompany.MyProject/Resources/Styles/MaterialStyleOverride.xaml
index e1758b73..1677d0e5 100644
--- a/templates/default/MyCompany.MyProject/Resources/Styles/MaterialStyleOverride.xaml
+++ b/templates/default/MyCompany.MyProject/Resources/Styles/MaterialStyleOverride.xaml
@@ -254,6 +254,65 @@
+
+
+
+
+
+
diff --git a/templates/uranium-material-resources/MaterialResourceStyle.xaml b/templates/uranium-material-resources/MaterialResourceStyle.xaml
index 8278c485..c2371192 100644
--- a/templates/uranium-material-resources/MaterialResourceStyle.xaml
+++ b/templates/uranium-material-resources/MaterialResourceStyle.xaml
@@ -256,6 +256,27 @@
+
+