Skip to content
This repository was archived by the owner on May 15, 2025. It is now read-only.

Commit 203a4b7

Browse files
Merge branch 'develop'
2 parents 6086b3a + 9eae9be commit 203a4b7

17 files changed

Lines changed: 113 additions & 24 deletions

MaterialDesignControls.nuspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
33
<metadata minClientVersion="2.8.1">
44
<id>Plugin.MaterialDesignControls</id>
5-
<version>1.5.0</version>
5+
<version>1.5.1</version>
66
<title>MaterialDesignControls Plugin for Xamarin Forms</title>
77
<authors>Horus</authors>
88
<owners>AgustinBonillaHorus</owners>

example/ExampleMaterialDesignControls/Pages/MaterialChipsPage.xaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,16 @@
3737
<material:MaterialLabel Text="Filters" Margin="0,24,0,0" />
3838
<FlexLayout Wrap="Wrap" Direction="Row" HorizontalOptions="FillAndExpand">
3939
<StackLayout>
40-
<material:MaterialChips Margin="0,10,10,0" BackgroundColor="Silver" TrailingIcon="cancel.png" TrailingIconCommand="{Binding IconTapCommand}" IsSelected="false" IsEnabled="true" Text="Opt J" />
40+
<material:MaterialChips Margin="0,10,10,0" BackgroundColor="Silver" TrailingIcon="cancel.png" TrailingIconCommand="{Binding IconTapCommand}" IsSelected="false" IsEnabled="true" Text="Opt J" ToUpper="True" />
4141
</StackLayout>
4242
<StackLayout>
43-
<material:MaterialChips Margin="0,10,10,0" BackgroundColor="Silver" TrailingIcon="cancel.png" TrailingIconCommand="{Binding IconTapCommand}" TrailingIconCommandParameter="Option K Clicked" IsSelected="false" IsEnabled="true" Text="This is option K" />
43+
<material:MaterialChips Margin="0,10,10,0" BackgroundColor="Silver" TrailingIcon="cancel.png" TrailingIconCommand="{Binding IconTapCommand}" TrailingIconCommandParameter="Option K Clicked" IsSelected="false" IsEnabled="true" Text="This is option K" ToUpper="True" />
4444
</StackLayout>
4545
<StackLayout>
46-
<material:MaterialChips Margin="0,10,10,0" BackgroundColor="Silver" TrailingIcon="cancel.png" TrailingIconCommand="{Binding IconTapCommand}" TrailingIconCommandParameter="Option L Clicked" IsSelected="false" IsEnabled="true" Text="Option L" />
46+
<material:MaterialChips Margin="0,10,10,0" BackgroundColor="Silver" TrailingIcon="cancel.png" TrailingIconCommand="{Binding IconTapCommand}" TrailingIconCommandParameter="Option L Clicked" IsSelected="false" IsEnabled="true" Text="Option L" ToUpper="True" />
4747
</StackLayout>
4848
<StackLayout>
49-
<material:MaterialChips Margin="0,10,10,0" BackgroundColor="Silver" LeadingIcon="delete.png" LeadingIconCommand="{Binding IconTapCommand}" LeadingIconCommandParameter="Delete command!" IsSelected="false" IsEnabled="true" Text="Option M" />
49+
<material:MaterialChips Margin="0,10,10,0" BackgroundColor="Silver" LeadingIcon="delete.png" LeadingIconCommand="{Binding IconTapCommand}" LeadingIconCommandParameter="Delete command!" IsSelected="false" IsEnabled="true" Text="Option M" ToUpper="True" />
5050
</StackLayout>
5151
</FlexLayout>
5252
<material:MaterialButton Text="Save" Icon="save.png" Command="{Binding TapCommand}" Margin="0,16,0,0" />

example/ExampleMaterialDesignControls/Pages/MaterialDatePickerPage.xaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<ContentPage.Content>
88
<ScrollView>
99
<StackLayout Padding="16" Spacing="16">
10-
<material:MaterialDatePicker Type="Filled" LabelText="Start date" Format="yyyy-MM-dd" LeadingIcon="calendar.png" />
10+
<material:MaterialDatePicker Date="{Binding Date}" Type="Filled" LabelText="Start date" Format="yyyy-MM-dd" LeadingIcon="calendar.png" Placeholder="Select date" PlaceholderColor="Red" />
1111
<material:MaterialDatePicker Type="Outlined" LabelText="End date" Format="dd/MM/yyyy" />
1212
<material:MaterialDatePicker Type="Lined" LabelText="Deadline" Format="dd/MM/yyyy" />
1313
<material:MaterialLabel Text="HorizontalTextAlignment" Margin="0,16,0,0" />
@@ -22,6 +22,7 @@
2222
</OnPlatform>
2323
</material:MaterialDatePicker.FontFamily>
2424
</material:MaterialDatePicker>
25+
<material:MaterialButton Text="Save" Icon="save.png" Command="{Binding TapCommand}" />
2526
</StackLayout>
2627
</ScrollView>
2728
</ContentPage.Content>

example/ExampleMaterialDesignControls/Pages/MaterialDatePickerPage.xaml.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using System;
22
using System.Collections.Generic;
3-
3+
using ExampleMaterialDesignControls.ViewModels;
44
using Xamarin.Forms;
55

66
namespace ExampleMaterialDesignControls.Pages
@@ -10,6 +10,8 @@ public partial class MaterialDatePickerPage : ContentPage
1010
public MaterialDatePickerPage()
1111
{
1212
InitializeComponent();
13+
14+
this.BindingContext = new MaterialDatePickerViewModel { DisplayAlert = this.DisplayAlert };
1315
}
1416
}
1517
}

example/ExampleMaterialDesignControls/Pages/MaterialPickerPage.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<ScrollView>
99
<StackLayout Padding="16" Spacing="16">
1010
<material:MaterialPicker x:Name="pckColors" Type="Filled" LabelText="Color" AnimateError="True" />
11-
<material:MaterialPicker x:Name="pckSizes" SelectedItem="{Binding SelectedSizes}" Type="Outlined" LabelText="Size" />
11+
<material:MaterialPicker x:Name="pckSizes" SelectedItem="{Binding SelectedSizes}" Type="Outlined" LabelText="Size" Placeholder="Select option" PlaceholderColor="Red" />
1212
<material:MaterialPicker x:Name="pckModels" Type="Lined" LabelText="Model" LeadingIcon="color.png" />
1313
<Label x:Name="lblSelectedIndex" Text="SelectedIndex: -" />
1414
<material:MaterialButton Text="Save" Icon="save.png" Command="{Binding TapCommand}" />

example/ExampleMaterialDesignControls/Pages/MaterialPickerPage.xaml.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ public MaterialPickerPage()
1919
this.pckModels.ItemsSource = new List<string> { "Model A", "Model B", "Model C", "Model D" };
2020
this.pckModels.SelectedIndexChanged += PckModels_SelectedIndexChanged;
2121

22-
this.SelectedSizes = "M";
23-
2422
this.pckModels2.ItemsSource = new List<string> { "Model A", "Model B", "Model C", "Model D" };
2523
this.pckModels3.ItemsSource = new List<string> { "Model A", "Model B", "Model C", "Model D" };
2624
this.pckModels4.ItemsSource = new List<string> { "Model A", "Model B", "Model C", "Model D" };
@@ -42,7 +40,7 @@ public async void OnTap(object parameter)
4240
if (!string.IsNullOrEmpty(this.pckColors.SelectedItem))
4341
{
4442
this.pckColors.AssistiveText = null;
45-
await this.DisplayAlert("", "Saved", "Ok");
43+
await this.DisplayAlert("Saved", !string.IsNullOrEmpty(this.SelectedSizes) ? this.SelectedSizes : "Select option", "Ok");
4644
}
4745
else
4846
{

example/ExampleMaterialDesignControls/Pages/MaterialTimePickerPage.xaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<ContentPage.Content>
88
<ScrollView>
99
<StackLayout Padding="16" Spacing="16">
10-
<material:MaterialTimePicker Type="Filled" LabelText="Start time" Format="HH:mm" LeadingIcon="calendar.png" />
10+
<material:MaterialTimePicker Time="{Binding Time}" Type="Filled" LabelText="Start time" Format="HH:mm" LeadingIcon="calendar.png" Placeholder="Select time" PlaceholderColor="Red" />
1111
<material:MaterialTimePicker Type="Outlined" LabelText="End time" Format="H:mm" />
1212
<material:MaterialTimePicker Type="Lined" LabelText="Deadline" Format="H:mm" />
1313
<material:MaterialLabel Text="HorizontalTextAlignment" Margin="0,16,0,0" />
@@ -22,6 +22,7 @@
2222
</OnPlatform>
2323
</material:MaterialTimePicker.FontFamily>
2424
</material:MaterialTimePicker>
25+
<material:MaterialButton Text="Save" Icon="save.png" Command="{Binding TapCommand}" />
2526
</StackLayout>
2627
</ScrollView>
2728
</ContentPage.Content>

example/ExampleMaterialDesignControls/Pages/MaterialTimePickerPage.xaml.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using System;
22
using System.Collections.Generic;
3-
3+
using ExampleMaterialDesignControls.ViewModels;
44
using Xamarin.Forms;
55

66
namespace ExampleMaterialDesignControls.Pages
@@ -10,6 +10,8 @@ public partial class MaterialTimePickerPage : ContentPage
1010
public MaterialTimePickerPage()
1111
{
1212
InitializeComponent();
13+
14+
this.BindingContext = new MaterialTimePickerViewModel { DisplayAlert = this.DisplayAlert };
1315
}
1416
}
1517
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
using System;
2+
using System.Threading.Tasks;
3+
using System.Windows.Input;
4+
using Xamarin.Forms;
5+
6+
namespace ExampleMaterialDesignControls.ViewModels
7+
{
8+
public class MaterialDatePickerViewModel : BaseViewModel
9+
{
10+
private DateTime? date;
11+
12+
public DateTime? Date
13+
{
14+
get { return date; }
15+
set { SetProperty(ref date, value); }
16+
}
17+
18+
public delegate Task DisplayAlertType(string title, string message, string cancel);
19+
20+
public DisplayAlertType DisplayAlert { get; set; }
21+
22+
public ICommand TapCommand => new Command(OnTapCommand);
23+
24+
private async void OnTapCommand()
25+
{
26+
await this.DisplayAlert.Invoke("", this.Date.HasValue ? this.Date.Value.ToShortDateString() : "Select date", "Ok");
27+
}
28+
}
29+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
using System;
2+
using System.Threading.Tasks;
3+
using System.Windows.Input;
4+
using Xamarin.Forms;
5+
6+
namespace ExampleMaterialDesignControls.ViewModels
7+
{
8+
public class MaterialTimePickerViewModel : BaseViewModel
9+
{
10+
private TimeSpan? time;
11+
12+
public TimeSpan? Time
13+
{
14+
get { return time; }
15+
set { SetProperty(ref time, value); }
16+
}
17+
18+
public delegate Task DisplayAlertType(string title, string message, string cancel);
19+
20+
public DisplayAlertType DisplayAlert { get; set; }
21+
22+
public ICommand TapCommand => new Command(OnTapCommand);
23+
24+
private async void OnTapCommand()
25+
{
26+
await this.DisplayAlert.Invoke("", this.Time.HasValue ? this.Time.Value.ToString() : "Select time", "Ok");
27+
}
28+
}
29+
}

0 commit comments

Comments
 (0)