From dc3aeef79cef256a881f2e9ba710f6b2d91e7ade Mon Sep 17 00:00:00 2001 From: Agustin Bonilla Date: Fri, 10 Nov 2023 18:39:46 -0300 Subject: [PATCH 1/6] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 02036fe..1407788 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ We're developing the next version of the plugin for .NET MAUI, bringing you exci ## Demo - + ## Content table - [Setup](#setup) From 98ca4aa5632348102ed070d141dad82ad3918a64 Mon Sep 17 00:00:00 2001 From: Agustin Bonilla Date: Mon, 20 Nov 2023 10:09:31 -0300 Subject: [PATCH 2/6] Fix a MaterialTopAppBar issue and add new properties to MaterialSegmented --- MaterialDesignControls.nuspec | 2 +- MaterialSegmentedControl.md | 10 +++++++++ .../Pages/MaterialSegmentedPage.xaml | 6 ++++- .../ControlsMaterial3/MaterialSegmented.cs | 22 +++++++++++++++++++ .../ControlsMaterial3/MaterialTopAppBar.cs | 21 +++++++++++++----- 5 files changed, 53 insertions(+), 8 deletions(-) diff --git a/MaterialDesignControls.nuspec b/MaterialDesignControls.nuspec index 57daa40..c4641ab 100755 --- a/MaterialDesignControls.nuspec +++ b/MaterialDesignControls.nuspec @@ -2,7 +2,7 @@ Plugin.MaterialDesignControls - 3.0.4 + 3.0.5 MaterialDesignControls Plugin for Xamarin Forms Horus AgustinBonillaHorus diff --git a/MaterialSegmentedControl.md b/MaterialSegmentedControl.md index 53f58aa..039fc93 100644 --- a/MaterialSegmentedControl.md +++ b/MaterialSegmentedControl.md @@ -139,6 +139,16 @@ This propperty is to set the fontfamily of the segment text.

+### Property SelectedFontSize: +This property is to set the fontsize of the selected segment text. +
+
+ +### Property SelectedFontFamily +This propperty is to set the fontfamily of the selected segment text. +
+
+ ### Property IsEnabled This property is to set if the control is enabled or not. By default is True.
diff --git a/example/ExampleMaterialDesignControls/Pages/MaterialSegmentedPage.xaml b/example/ExampleMaterialDesignControls/Pages/MaterialSegmentedPage.xaml index f8e9dae..1fe2bcc 100644 --- a/example/ExampleMaterialDesignControls/Pages/MaterialSegmentedPage.xaml +++ b/example/ExampleMaterialDesignControls/Pages/MaterialSegmentedPage.xaml @@ -128,7 +128,11 @@ SelectedColor="{StaticResource GradientColor9}" SelectedTextColor="Black" UnselectedColor="#F5F5F5" - UnselectedTextColor="{StaticResource GradientColor9}" /> + UnselectedTextColor="{StaticResource GradientColor9}" + FontSize="13" + SelectedFontSize="18" + FontFamily="{StaticResource LightFont}" + SelectedFontFamily="{StaticResource BoldFont}" /> diff --git a/src/MaterialDesignControls/ControlsMaterial3/MaterialSegmented.cs b/src/MaterialDesignControls/ControlsMaterial3/MaterialSegmented.cs index 97efcba..3eab668 100644 --- a/src/MaterialDesignControls/ControlsMaterial3/MaterialSegmented.cs +++ b/src/MaterialDesignControls/ControlsMaterial3/MaterialSegmented.cs @@ -214,6 +214,24 @@ public string FontFamily set { SetValue(FontFamilyProperty, value); } } + public static readonly BindableProperty SelectedFontSizeProperty = + BindableProperty.Create(nameof(SelectedFontSize), typeof(double), typeof(MaterialSegmented), defaultValue: MaterialFontSize.LabelLarge); + + public double SelectedFontSize + { + get { return (double)GetValue(SelectedFontSizeProperty); } + set { SetValue(SelectedFontSizeProperty, value); } + } + + public static readonly BindableProperty SelectedFontFamilyProperty = + BindableProperty.Create(nameof(SelectedFontFamily), typeof(string), typeof(MaterialSegmented), defaultValue: MaterialFontFamily.Default); + + public string SelectedFontFamily + { + get { return (string)GetValue(SelectedFontFamilyProperty); } + set { SetValue(SelectedFontFamilyProperty, value); } + } + public static readonly BindableProperty DisabledBorderColorProperty = BindableProperty.Create(nameof(DisabledBorderColor), typeof(Color), typeof(MaterialSegmented), defaultValue: MaterialColor.Disable); @@ -504,6 +522,8 @@ private void SetItemContentAndColors(MaterialCard card, MaterialLabel label, Mat { card.BackgroundColor = IsEnabled ? SelectedColor : DisabledSelectedColor; label.TextColor = IsEnabled ? SelectedTextColor : DisabledSelectedTextColor; + label.FontSize = SelectedFontSize; + label.FontFamily = SelectedFontFamily; if (item.SelectedIconIsVisible) { @@ -531,6 +551,8 @@ private void SetItemContentAndColors(MaterialCard card, MaterialLabel label, Mat { card.BackgroundColor = IsEnabled ? UnselectedColor : DisabledUnselectedColor; label.TextColor = IsEnabled ? UnselectedTextColor : DisabledUnselectedTextColor; + label.FontSize = FontSize; + label.FontFamily = FontFamily; if (item.UnselectedIconIsVisible) { diff --git a/src/MaterialDesignControls/ControlsMaterial3/MaterialTopAppBar.cs b/src/MaterialDesignControls/ControlsMaterial3/MaterialTopAppBar.cs index 96e78f8..1d68483 100644 --- a/src/MaterialDesignControls/ControlsMaterial3/MaterialTopAppBar.cs +++ b/src/MaterialDesignControls/ControlsMaterial3/MaterialTopAppBar.cs @@ -37,9 +37,6 @@ public class MaterialTopAppBar : Grid private double _descriptionLateralMargin = 10; - private double _mediumDefaultFontSize = 28; - private double _largeDefaultFontSize = 32; - private int _smallRowHeight = 48; private int _mediumRowHeight = 106; private int _largeRowHeight = 106; @@ -636,7 +633,7 @@ private void SetScrollViewAnimation() int maxHeight = Type == MaterialTopAppBarType.Large ? _largeRowHeight : _mediumRowHeight; int minHeight = _smallRowHeight; - double maxFontSize = Type == MaterialTopAppBarType.Large ? _largeDefaultFontSize : _mediumDefaultFontSize; + double maxFontSize = Type == MaterialTopAppBarType.Large ? MaterialFontSize.HeadlineMedium : MaterialFontSize.HeadlineSmall; double minFontSize = HeadlineFontSize; int maxLabelLateralMargin = Type == MaterialTopAppBarType.Large ? _largeLabelLateralMargin : _mediumLabelLateralMargin; @@ -708,25 +705,37 @@ private void SetType() switch (Type) { case MaterialTopAppBarType.Small: + _leadingIconCustomImageButton.VerticalOptions = LayoutOptions.Center; + _cntLeadingActivityIndicator.VerticalOptions = LayoutOptions.Center; + _trailingIconCustomImageButton.VerticalOptions = LayoutOptions.Center; + _cntTrailingActivityIndicator.VerticalOptions = LayoutOptions.Center; _headlineLabel.HorizontalTextAlignment = TextAlignment.Start; _headlineLabel.Margin = new Thickness(_smallLabelLateralMargin, HeadlineMarginAdjustment.Top, _smallLabelLateralMargin, HeadlineMarginAdjustment.Bottom); _descriptionLabel.HorizontalTextAlignment = TextAlignment.Start; _descriptionLabel.Margin = new Thickness(_descriptionLateralMargin, DescriptionMarginAdjustment.Top, _descriptionLateralMargin, DescriptionMarginAdjustment.Bottom); break; case MaterialTopAppBarType.Medium: + _leadingIconCustomImageButton.VerticalOptions = LayoutOptions.Start; + _cntLeadingActivityIndicator.VerticalOptions = LayoutOptions.Start; + _trailingIconCustomImageButton.VerticalOptions = LayoutOptions.Start; + _cntTrailingActivityIndicator.VerticalOptions = LayoutOptions.Start; _headlineLabel.HorizontalTextAlignment = TextAlignment.Start; _headlineLabel.VerticalOptions = LayoutOptions.End; _headlineLabel.Margin = new Thickness(_mediumLabelLateralMargin, HeadlineMarginAdjustment.Top, _mediumLabelLateralMargin, HeadlineMarginAdjustment.Bottom); - _headlineLabel.FontSize = _mediumDefaultFontSize; + _headlineLabel.FontSize = MaterialFontSize.HeadlineSmall; RowDefinitions[0].Height = new GridLength(_mediumRowHeight); _descriptionLabel.HorizontalTextAlignment = TextAlignment.Start; _descriptionLabel.Margin = new Thickness(_descriptionLateralMargin, DescriptionMarginAdjustment.Top, _descriptionLateralMargin, DescriptionMarginAdjustment.Bottom); break; case MaterialTopAppBarType.Large: + _leadingIconCustomImageButton.VerticalOptions = LayoutOptions.Start; + _cntLeadingActivityIndicator.VerticalOptions = LayoutOptions.Start; + _trailingIconCustomImageButton.VerticalOptions = LayoutOptions.Start; + _cntTrailingActivityIndicator.VerticalOptions = LayoutOptions.Start; _headlineLabel.HorizontalTextAlignment = TextAlignment.Start; _headlineLabel.VerticalOptions = LayoutOptions.End; _headlineLabel.Margin = new Thickness(_largeLabelLateralMargin, HeadlineMarginAdjustment.Top, _largeLabelLateralMargin, HeadlineMarginAdjustment.Bottom); - _headlineLabel.FontSize = _largeDefaultFontSize; + _headlineLabel.FontSize = MaterialFontSize.HeadlineMedium; RowDefinitions[0].Height = new GridLength(_largeRowHeight); _descriptionLabel.HorizontalTextAlignment = TextAlignment.Start; _descriptionLabel.Margin = new Thickness(_descriptionLateralMargin, DescriptionMarginAdjustment.Top, _descriptionLateralMargin, DescriptionMarginAdjustment.Bottom); From 00463d4c7afdef5fa4c4da5ca694c768b45db197 Mon Sep 17 00:00:00 2001 From: Agustin Bonilla Date: Tue, 21 Nov 2023 13:50:59 -0300 Subject: [PATCH 3/6] Prevent effects stripping by linker --- src/MaterialDesignControls.Android/Effects.cs | 4 ++++ src/MaterialDesignControls.iOS/Effects.cs | 3 +++ 2 files changed, 7 insertions(+) diff --git a/src/MaterialDesignControls.Android/Effects.cs b/src/MaterialDesignControls.Android/Effects.cs index f8ae3e2..b9798cf 100644 --- a/src/MaterialDesignControls.Android/Effects.cs +++ b/src/MaterialDesignControls.Android/Effects.cs @@ -13,6 +13,10 @@ public static class Effects public static void Init() { + // Prevent stripping by linker + new TouchAndPressEffect(); + new TouchReleaseEffect(); + _allEffects = new List(typeof(Effects).Assembly.GetTypes() .Where(t => typeof(PlatformEffect).IsAssignableFrom(t)) .Select(t => (PlatformEffect)Activator.CreateInstance(t))); diff --git a/src/MaterialDesignControls.iOS/Effects.cs b/src/MaterialDesignControls.iOS/Effects.cs index 84ce659..a7c55f7 100644 --- a/src/MaterialDesignControls.iOS/Effects.cs +++ b/src/MaterialDesignControls.iOS/Effects.cs @@ -13,6 +13,9 @@ public static class Effects public static void Init() { + // Prevent stripping by linker + new TouchAndPressEffect(); + _allEffects = new List(typeof(Effects).Assembly.GetTypes() .Where(t => typeof(PlatformEffect).IsAssignableFrom(t)) .Select(t => (PlatformEffect)Activator.CreateInstance(t))); From a185e294b7525b75608eccf8954feab1b11e57c1 Mon Sep 17 00:00:00 2001 From: Agustin Bonilla Date: Thu, 23 Nov 2023 09:35:35 -0300 Subject: [PATCH 4/6] Add padding property to readme files --- MaterialDatePickerControl.md | 8 ++++---- MaterialDoublePickerControl.md | 6 ++++-- MaterialEditorControl.md | 5 ++++- MaterialEntryControl.md | 5 +++++ MaterialPickerControl.md | 4 ++++ MaterialSearch.md | 5 +++++ MaterialSelectionControl.md | 5 +++++ MaterialTimePickerControl.md | 5 +++++ .../ControlsMaterial3/MaterialSelection.cs | 2 +- .../ControlsMaterial3/MaterialSwitch.cs | 6 +++--- .../ControlsMaterial3/MaterialTimePicker.cs | 2 +- 11 files changed, 41 insertions(+), 12 deletions(-) diff --git a/MaterialDatePickerControl.md b/MaterialDatePickerControl.md index e1ed989..5ebaa83 100644 --- a/MaterialDatePickerControl.md +++ b/MaterialDatePickerControl.md @@ -278,7 +278,7 @@ This property is to set the Supporting LineBreakMode.

- - - - +### Property Padding: +This property is to set the padding of the control. By default uses (16, 8). +
+
\ No newline at end of file diff --git a/MaterialDoublePickerControl.md b/MaterialDoublePickerControl.md index 5d12dd2..2ed8957 100644 --- a/MaterialDoublePickerControl.md +++ b/MaterialDoublePickerControl.md @@ -291,5 +291,7 @@ This property is to set the Supporting LineBreakMode.

- - +### Property Padding: +This property is to set the padding of the control. By default uses (16, 8). +
+
\ No newline at end of file diff --git a/MaterialEditorControl.md b/MaterialEditorControl.md index ca366fc..1bfc336 100644 --- a/MaterialEditorControl.md +++ b/MaterialEditorControl.md @@ -321,4 +321,7 @@ This property is to set autosize editor.

- +### Property Padding: +This property is to set the padding of the control. By default uses (16, 8). +
+
\ No newline at end of file diff --git a/MaterialEntryControl.md b/MaterialEntryControl.md index af10ca2..6e68020 100644 --- a/MaterialEntryControl.md +++ b/MaterialEntryControl.md @@ -354,4 +354,9 @@ This property is to set the Supporting LineBreakMode. - TailTruncation, - MiddleTruncation
+
+ +### Property Padding: +This property is to set the padding of the control. By default uses (16, 8). +

\ No newline at end of file diff --git a/MaterialPickerControl.md b/MaterialPickerControl.md index 6634985..2fd9b21 100644 --- a/MaterialPickerControl.md +++ b/MaterialPickerControl.md @@ -270,3 +270,7 @@ This property is to get the selected index

+### Property Padding: +This property is to set the padding of the control. By default uses (16, 8). +
+
\ No newline at end of file diff --git a/MaterialSearch.md b/MaterialSearch.md index 65ea916..43ef287 100644 --- a/MaterialSearch.md +++ b/MaterialSearch.md @@ -248,4 +248,9 @@ This property is to set the Supporting LineBreakMode. - TailTruncation, - MiddleTruncation
+
+ +### Property Padding: +This property is to set the padding of the control. By default uses (16, 8). +

\ No newline at end of file diff --git a/MaterialSelectionControl.md b/MaterialSelectionControl.md index dd49fe8..2033ebb 100644 --- a/MaterialSelectionControl.md +++ b/MaterialSelectionControl.md @@ -253,3 +253,8 @@ This property is to set the command. This property is to set the command parameter.

+ +### Property Padding: +This property is to set the padding of the control. By default uses (16, 8). +
+
\ No newline at end of file diff --git a/MaterialTimePickerControl.md b/MaterialTimePickerControl.md index 4276b59..cae0b15 100644 --- a/MaterialTimePickerControl.md +++ b/MaterialTimePickerControl.md @@ -217,3 +217,8 @@ This property is to set Time. This property is to set time Format.

+ +### Property Padding: +This property is to set the padding of the control. By default uses (16, 8). +
+
\ No newline at end of file diff --git a/src/MaterialDesignControls/ControlsMaterial3/MaterialSelection.cs b/src/MaterialDesignControls/ControlsMaterial3/MaterialSelection.cs index 6ff1f76..4e7b81d 100644 --- a/src/MaterialDesignControls/ControlsMaterial3/MaterialSelection.cs +++ b/src/MaterialDesignControls/ControlsMaterial3/MaterialSelection.cs @@ -32,7 +32,7 @@ public MaterialSelection() public new static readonly BindableProperty AnimatePlaceholderProperty = - BindableProperty.Create(nameof(AnimatePlaceholder), typeof(bool), typeof(BaseMaterialFieldControl), defaultValue: false); + BindableProperty.Create(nameof(AnimatePlaceholder), typeof(bool), typeof(MaterialSelection), defaultValue: false); public new bool AnimatePlaceholder => false; diff --git a/src/MaterialDesignControls/ControlsMaterial3/MaterialSwitch.cs b/src/MaterialDesignControls/ControlsMaterial3/MaterialSwitch.cs index bc4d8a8..3af9932 100644 --- a/src/MaterialDesignControls/ControlsMaterial3/MaterialSwitch.cs +++ b/src/MaterialDesignControls/ControlsMaterial3/MaterialSwitch.cs @@ -233,7 +233,7 @@ public string SelectedIcon } public static readonly BindableProperty CustomSelectedIconProperty = - BindableProperty.Create(nameof(CustomSelectedIcon), typeof(View), typeof(BaseMaterialFieldControl), defaultValue: null); + BindableProperty.Create(nameof(CustomSelectedIcon), typeof(View), typeof(MaterialSwitch), defaultValue: null); public View CustomSelectedIcon { @@ -242,7 +242,7 @@ public View CustomSelectedIcon } public static readonly BindableProperty UnselectedIconProperty = - BindableProperty.Create(nameof(UnselectedIcon), typeof(string), typeof(BaseMaterialFieldControl), defaultValue: null); + BindableProperty.Create(nameof(UnselectedIcon), typeof(string), typeof(MaterialSwitch), defaultValue: null); public string UnselectedIcon { @@ -251,7 +251,7 @@ public string UnselectedIcon } public static readonly BindableProperty CustomUnselectedIconProperty = - BindableProperty.Create(nameof(CustomUnselectedIcon), typeof(View), typeof(BaseMaterialFieldControl), defaultValue: null); + BindableProperty.Create(nameof(CustomUnselectedIcon), typeof(View), typeof(MaterialSwitch), defaultValue: null); public View CustomUnselectedIcon { diff --git a/src/MaterialDesignControls/ControlsMaterial3/MaterialTimePicker.cs b/src/MaterialDesignControls/ControlsMaterial3/MaterialTimePicker.cs index 0362210..070c89d 100644 --- a/src/MaterialDesignControls/ControlsMaterial3/MaterialTimePicker.cs +++ b/src/MaterialDesignControls/ControlsMaterial3/MaterialTimePicker.cs @@ -49,7 +49,7 @@ public MaterialTimePicker() #region Properties public new static readonly BindableProperty AnimatePlaceholderProperty = - BindableProperty.Create(nameof(AnimatePlaceholder), typeof(bool), typeof(BaseMaterialFieldControl), defaultValue: false); + BindableProperty.Create(nameof(AnimatePlaceholder), typeof(bool), typeof(MaterialTimePicker), defaultValue: false); public new bool AnimatePlaceholder => false; From 9bbd4091782e1e7cdacb3a2ece70e21f3f19ff00 Mon Sep 17 00:00:00 2001 From: Agustin Bonilla Date: Thu, 23 Nov 2023 11:43:40 -0300 Subject: [PATCH 5/6] Fix a padding issue on BaseMaterialFieldControl --- .../BaseMaterialFieldControl.cs | 23 +++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/src/MaterialDesignControls/ControlsMaterial3/BaseMaterialFieldControl.cs b/src/MaterialDesignControls/ControlsMaterial3/BaseMaterialFieldControl.cs index 779154d..287c71f 100644 --- a/src/MaterialDesignControls/ControlsMaterial3/BaseMaterialFieldControl.cs +++ b/src/MaterialDesignControls/ControlsMaterial3/BaseMaterialFieldControl.cs @@ -77,6 +77,15 @@ public TextAlignment HorizontalTextAlignment set { SetValue(HorizontalTextAlignmentProperty, value); } } + public static readonly new BindableProperty PaddingProperty = + BindableProperty.Create(nameof(Padding), typeof(Thickness), typeof(BaseMaterialFieldControl), defaultValue: new Thickness(16, 8)); + + public new Thickness Padding + { + get { return (Thickness)GetValue(PaddingProperty); } + set { SetValue(PaddingProperty, value); } + } + #endregion Properties #region Text @@ -704,7 +713,7 @@ public void UpdateLayout(string propertyName) this._lblLabel.Margin = LabelMargin; break; case nameof(Padding): - _frmContainer.Padding = this.Padding; + _frmContainer.Padding = Padding; break; case nameof(CornerRadius): this._frmContainer.CornerRadius = CornerRadius; @@ -823,7 +832,7 @@ protected virtual void Initialize() { CornerRadius = new CornerRadius(10, 10, 0, 0), HasShadow = false, - Padding = new Thickness(16, 8), + Padding = Padding, Type = MaterialCardType.Custom }; @@ -833,14 +842,14 @@ protected virtual void Initialize() RowSpacing = 0, RowDefinitions = new RowDefinitionCollection() { - new RowDefinition(){ Height = 16 }, - new RowDefinition(){ Height = 24 } + new RowDefinition { Height = 16 }, + new RowDefinition { Height = 24 } }, ColumnDefinitions = new ColumnDefinitionCollection() { - new ColumnDefinition(){Width = GridLength.Auto }, - new ColumnDefinition(){Width = GridLength.Star }, - new ColumnDefinition(){Width = GridLength.Auto } + new ColumnDefinition { Width = GridLength.Auto }, + new ColumnDefinition { Width = GridLength.Star }, + new ColumnDefinition { Width = GridLength.Auto } } }; From e1b66cb4fcc680dd2b8d1a23fcf51374e100fa7c Mon Sep 17 00:00:00 2001 From: Agustin Bonilla Date: Sun, 26 Nov 2023 16:12:06 -0300 Subject: [PATCH 6/6] Fix issue and add improvements to MaterialDialog --- MaterialDialog.md | 12 +++++ .../Pages/MaterialDialogPage.xaml | 16 ++++--- .../ControlsMaterial3/MaterialCheckBox.cs | 8 +++- .../ControlsMaterial3/MaterialDialog.cs | 44 +++++++++++++++++-- 4 files changed, 70 insertions(+), 10 deletions(-) diff --git a/MaterialDialog.md b/MaterialDialog.md index 45261ed..31b0687 100644 --- a/MaterialDialog.md +++ b/MaterialDialog.md @@ -133,6 +133,10 @@ This property is to the font size of the cancel button. This property is to the font family of the cancel button.
+### Property CancelCornerRadius: +This property is to set the corner radius of cancel button. +
+ ### Property CancelCommand: This property is to the command of the cancel button.
@@ -165,6 +169,10 @@ This property is to the font size of the accept button. This property is to the font family of the accept button.
+### Property AcceptCornerRadius: +This property is to set the corner radius of accept button. +
+ ### Property AcceptCommand: This property is to the command of the accept button.
@@ -264,4 +272,8 @@ This property is to set the icon when is unchecked. It is a DataTemplate propert ### Property ItemCheckboxSize This property is to set the size of the checkbox. +
+ +### Property ItemCheckboxSpacing +This property is to set the spacing of the checkbox.
\ No newline at end of file diff --git a/example/ExampleMaterialDesignControls/Pages/MaterialDialogPage.xaml b/example/ExampleMaterialDesignControls/Pages/MaterialDialogPage.xaml index 524d98c..11b861c 100644 --- a/example/ExampleMaterialDesignControls/Pages/MaterialDialogPage.xaml +++ b/example/ExampleMaterialDesignControls/Pages/MaterialDialogPage.xaml @@ -59,16 +59,17 @@ + HeightRequest="500" + AllowMultiselect="True" /> @@ -100,15 +101,18 @@ DividerColor="DarkBlue" CancelTextColor="DarkBlue" CancelFontSize="12" - AcceptTextColor="DarkBlue" - AcceptBackgroundColor="Transparent" + CancelCornerRadius="4" + AcceptTextColor="LightSkyBlue" + AcceptBackgroundColor="DarkBlue" AcceptFontSize="16" + AcceptCornerRadius="4" SearchTextColor="DarkBlue" SearchBackgroundColor="LightSkyBlue" SearchTextAlignment="Center" ItemTextFontSize="14" ItemTextColor="DarkBlue" - HeightRequest="500"> + HeightRequest="500" + ItemCheckboxSpacing="0"> diff --git a/src/MaterialDesignControls/ControlsMaterial3/MaterialCheckBox.cs b/src/MaterialDesignControls/ControlsMaterial3/MaterialCheckBox.cs index 7cc4663..020008e 100644 --- a/src/MaterialDesignControls/ControlsMaterial3/MaterialCheckBox.cs +++ b/src/MaterialDesignControls/ControlsMaterial3/MaterialCheckBox.cs @@ -171,7 +171,9 @@ private void Initialize() VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center, WidthRequest = 40, - HeightRequest = 40 + HeightRequest = 40, + MinimumWidthRequest = 40, + MinimumHeightRequest = 40 }; _chk = new CustomCheckBox() @@ -204,6 +206,8 @@ private void Initialize() HorizontalOptions = LayoutOptions.Center, WidthRequest = 40, HeightRequest = 40, + MinimumWidthRequest = 40, + MinimumHeightRequest = 40, IsVisible = false }; @@ -232,6 +236,8 @@ private void Initialize() HorizontalOptions = LayoutOptions.Center, WidthRequest = 40, HeightRequest = 40, + MinimumWidthRequest = 40, + MinimumHeightRequest = 40, IsVisible = false }; diff --git a/src/MaterialDesignControls/ControlsMaterial3/MaterialDialog.cs b/src/MaterialDesignControls/ControlsMaterial3/MaterialDialog.cs index 1d4a934..1de5ca7 100644 --- a/src/MaterialDesignControls/ControlsMaterial3/MaterialDialog.cs +++ b/src/MaterialDesignControls/ControlsMaterial3/MaterialDialog.cs @@ -313,6 +313,15 @@ public bool CancelIsBusy set { SetValue(CancelIsBusyProperty, value); } } + public static readonly BindableProperty CancelCornerRadiusProperty = + BindableProperty.Create(nameof(CancelCornerRadius), typeof(float), typeof(MaterialDialog), defaultValue: 20f); + + public float CancelCornerRadius + { + get { return (float)GetValue(CancelCornerRadiusProperty); } + set { SetValue(CancelCornerRadiusProperty, value); } + } + #endregion CancelButton #region AcceptButton @@ -389,6 +398,15 @@ public bool AcceptIsBusy set { SetValue(AcceptIsBusyProperty, value); } } + public static readonly BindableProperty AcceptCornerRadiusProperty = + BindableProperty.Create(nameof(AcceptCornerRadius), typeof(float), typeof(MaterialDialog), defaultValue: 20f); + + public float AcceptCornerRadius + { + get { return (float)GetValue(AcceptCornerRadiusProperty); } + set { SetValue(AcceptCornerRadiusProperty, value); } + } + #endregion AcceptButton public static readonly BindableProperty ButtonsAlignmentProperty = @@ -568,6 +586,15 @@ public double ItemCheckboxSize set { SetValue(ItemCheckboxSizeProperty, value); } } + public static readonly BindableProperty ItemCheckboxSpacingProperty = + BindableProperty.Create(nameof(ItemCheckboxSpacing), typeof(double), typeof(MaterialDialog), defaultValue: 10.0); + + public double ItemCheckboxSpacing + { + get { return (double)GetValue(ItemCheckboxSpacingProperty); } + set { SetValue(ItemCheckboxSpacingProperty, value); } + } + #endregion Items #region Constructor @@ -691,6 +718,10 @@ protected override void OnPropertyChanged([CallerMemberName] string propertyName _cancelBtn.IsBusy = CancelIsBusy; break; + case nameof(CancelCornerRadius): + _cancelBtn.CornerRadius = CancelCornerRadius; + break; + case nameof(AcceptText): _acceptBtn.Text = AcceptText; break; @@ -719,6 +750,10 @@ protected override void OnPropertyChanged([CallerMemberName] string propertyName _acceptBtn.IsBusy = AcceptIsBusy; break; + case nameof(AcceptCornerRadius): + _acceptBtn.CornerRadius = AcceptCornerRadius; + break; + case nameof(CancelCommand): _cancelBtn.Command = CancelCommand; break; @@ -890,7 +925,8 @@ private void Initialize() BackgroundColor = CancelBackgroundColor, Command = CancelCommand, IsVisible = !string.IsNullOrWhiteSpace(CancelText), - MinimumWidthRequest = 80 + MinimumWidthRequest = 80, + CornerRadius = CancelCornerRadius }; _acceptBtn = new MaterialButton @@ -903,7 +939,8 @@ private void Initialize() BackgroundColor = AcceptBackgroundColor, Margin = new Thickness(0), Command = AcceptCommand, - MinimumWidthRequest = 80 + MinimumWidthRequest = 80, + CornerRadius = AcceptCornerRadius }; _btnsContainer.Children.Add(_cancelBtn); @@ -913,7 +950,6 @@ private void Initialize() Content = _mainContainer; - //Xamarin.Forms.PlatformConfiguration.AndroidSpecific.VisualElement.SetElevation(this, 0); initialized = true; } } @@ -952,6 +988,8 @@ private void RefreshItemList(IEnumerable list) materialCheckbox.CustomSelectedIcon = ItemCheckboxCustomSelectedIcon; materialCheckbox.CustomUnselectedIcon = ItemCheckboxCustomUnselectedIcon; materialCheckbox.IsChecked = item.IsSelected; + materialCheckbox.Spacing = ItemCheckboxSpacing; + materialCheckbox.IsRadioButtonStyle = !AllowMultiselect; _optionsContainer.Children.Add(materialCheckbox); }