Skip to content

Commit 6166d23

Browse files
authored
Added label sizes for title, action / cancel buttons (#231)
* Added label sizes for title, action / cancel buttons * Added default value comments
1 parent 82cdc30 commit 6166d23

File tree

2 files changed

+56
-3
lines changed

2 files changed

+56
-3
lines changed

src/DIPS.Xamarin.UI/Controls/Sheet/SheetBehavior.cs

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,59 @@ public class SheetBehavior : Behavior<ModalityLayout>, IModalityHandler
6262
typeof(ICommand),
6363
typeof(SheetBehavior));
6464

65+
/// <summary>
66+
/// The size of the title label.
67+
/// This is a bindable property.
68+
/// </summary>
69+
/// <remarks>Default value is <see cref="NamedSize.Medium"/></remarks>
70+
[TypeConverter(typeof(FontSizeConverter))]
71+
public double TitleSize
72+
{
73+
get => (double)GetValue(TitleSizeProperty);
74+
set => SetValue(TitleSizeProperty, value);
75+
}
76+
77+
/// <summary>
78+
/// <see cref="TitleSize"/>
79+
/// </summary>
80+
public static readonly BindableProperty TitleSizeProperty = BindableProperty.Create(nameof(TitleSize), typeof(double), typeof(SheetBehavior), defaultValueCreator:b => Device.GetNamedSize(NamedSize.Medium, typeof(Label)));
81+
82+
/// <summary>
83+
/// The size of the label of the cancel button.
84+
/// This is a bindable property.
85+
/// </summary>
86+
/// <remarks>Default value is <see cref="NamedSize.Small"/></remarks>
87+
[TypeConverter(typeof(FontSizeConverter))]
88+
public double CancelButtonSize
89+
{
90+
get => (double)GetValue(CancelButtonSizeProperty);
91+
set => SetValue(CancelButtonSizeProperty, value);
92+
}
93+
94+
/// <summary>
95+
/// <see cref="CancelButtonSize"/>
96+
/// </summary>
97+
public static readonly BindableProperty CancelButtonSizeProperty = BindableProperty.Create(nameof(CancelButtonSize), typeof(double), typeof(SheetBehavior), defaultValueCreator: b => Device.GetNamedSize(NamedSize.Small, typeof(Button)));
98+
99+
/// <summary>
100+
/// The size of the label of the action button.
101+
/// This is a bindable property.
102+
/// <remarks>Default value is <see cref="NamedSize.Small"/></remarks>
103+
/// </summary>
104+
[TypeConverter(typeof(FontSizeConverter))]
105+
public double ActionButtonSize
106+
{
107+
get => (double)GetValue(ActionButtonSizeProperty);
108+
set => SetValue(ActionButtonSizeProperty, value);
109+
}
110+
111+
/// <summary>
112+
/// <see cref="ActionButtonSize"/>
113+
/// </summary>
114+
public static readonly BindableProperty ActionButtonSizeProperty = BindableProperty.Create(nameof(ActionButtonSize), typeof(double), typeof(SheetBehavior), defaultValueCreator: b => Device.GetNamedSize(NamedSize.Small, typeof(Button)));
115+
116+
117+
65118
/// <summary>
66119
/// <see cref="OnBeforeCloseCommandParameter" />
67120
/// </summary>

src/DIPS.Xamarin.UI/Internal/Xaml/SheetView.xaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
<Label x:Name="TitleLabel"
7676
Grid.Column="0"
7777
Grid.ColumnSpan="3"
78-
FontSize="Large"
78+
FontSize="{Binding TitleSize}"
7979
FontAttributes="Bold"
8080
HorizontalOptions="Center"
8181
Padding="10"
@@ -87,7 +87,7 @@
8787

8888
<Button x:Name="cancelButton"
8989
Grid.Column="0"
90-
FontSize="Medium"
90+
FontSize="{Binding CancelButtonSize}"
9191
Padding="10"
9292
IsVisible="{Binding IsCancelButtonVisible}"
9393
TextColor="{Binding CancelTitleColor}"
@@ -99,7 +99,7 @@
9999

100100
<Button x:Name="actionButton"
101101
Grid.Column="2"
102-
FontSize="Medium"
102+
FontSize="{Binding ActionButtonSize}"
103103
Padding="10"
104104
BackgroundColor="{Binding HeaderColor}"
105105
Command="{Binding ActionCommand}"

0 commit comments

Comments
 (0)