-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #70 from MykhailoDav/refactoring_view_models_and_a…
…dding_samples Refactored viewmodels; Added new samples
- Loading branch information
Showing
71 changed files
with
1,645 additions
and
1,261 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,10 @@ | ||
namespace SampleApp.Controls | ||
namespace SampleApp.Controls; | ||
|
||
[XamlCompilation(XamlCompilationOptions.Compile)] | ||
public partial class CalendarFooter : ContentView | ||
{ | ||
[XamlCompilation(XamlCompilationOptions.Compile)] | ||
public partial class CalendarFooter : ContentView | ||
public CalendarFooter() | ||
{ | ||
public CalendarFooter() | ||
{ | ||
InitializeComponent(); | ||
} | ||
InitializeComponent(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,10 @@ | ||
namespace SampleApp.Controls | ||
namespace SampleApp.Controls; | ||
|
||
[XamlCompilation(XamlCompilationOptions.Compile)] | ||
public partial class CalendarHeader : DataTemplate | ||
{ | ||
[XamlCompilation(XamlCompilationOptions.Compile)] | ||
public partial class CalendarHeader : DataTemplate | ||
public CalendarHeader() | ||
{ | ||
public CalendarHeader() | ||
{ | ||
InitializeComponent(); | ||
} | ||
InitializeComponent(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,27 @@ | ||
using SampleApp.Model; | ||
using System.Windows.Input; | ||
using System.Windows.Input; | ||
|
||
namespace SampleApp.Controls | ||
namespace SampleApp.Controls; | ||
|
||
[XamlCompilation(XamlCompilationOptions.Compile)] | ||
public partial class CalenderEvent : ContentView | ||
{ | ||
[XamlCompilation(XamlCompilationOptions.Compile)] | ||
public partial class CalenderEvent : ContentView | ||
{ | ||
public static BindableProperty CalenderEventCommandProperty = | ||
BindableProperty.Create(nameof(CalenderEventCommand), typeof(ICommand), typeof(CalenderEvent), null); | ||
public static BindableProperty CalenderEventCommandProperty = | ||
BindableProperty.Create(nameof(CalenderEventCommand), typeof(ICommand), typeof(CalenderEvent), null); | ||
|
||
public CalenderEvent() | ||
{ | ||
InitializeComponent(); | ||
} | ||
public CalenderEvent() | ||
{ | ||
InitializeComponent(); | ||
} | ||
|
||
public ICommand CalenderEventCommand | ||
{ | ||
get => (ICommand)GetValue(CalenderEventCommandProperty); | ||
set => SetValue(CalenderEventCommandProperty, value); | ||
} | ||
public ICommand CalenderEventCommand | ||
{ | ||
get => (ICommand)GetValue(CalenderEventCommandProperty); | ||
set => SetValue(CalenderEventCommandProperty, value); | ||
} | ||
|
||
private void TapGestureRecognizer_Tapped(object sender, System.EventArgs e) | ||
{ | ||
if (BindingContext is AdvancedEventModel eventModel) | ||
CalenderEventCommand?.Execute(eventModel); | ||
} | ||
private void TapGestureRecognizer_Tapped(object sender, System.EventArgs e) | ||
{ | ||
if (BindingContext is AdvancedEventModel eventModel) | ||
CalenderEventCommand?.Execute(eventModel); | ||
} | ||
} |
73 changes: 73 additions & 0 deletions
73
samples/SampleApp/Controls/DefaultDeviceCalendarHeaders/Windows11CalendarHeader.xaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<ContentView | ||
x:Class="SampleApp.Controls.Windows11CalendarHeader" | ||
xmlns="http://schemas.microsoft.com/dotnet/2021/maui" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||
xmlns:controls="clr-namespace:SampleApp.Controls" | ||
xmlns:toolkit="http://schemas.microsoft.com/dotnet/2022/maui/toolkit" | ||
x:Name="Header" | ||
x:DataType="controls:CalendarHeader"> | ||
<ContentView.Resources> | ||
<ResourceDictionary> | ||
<Style x:Key="arrowButtonPrevStyle" TargetType="Button"> | ||
<Setter Property="FontFamily" Value="FontAwesomeSolid" /> | ||
<Setter Property="BorderColor" Value="Transparent" /> | ||
<Setter Property="BackgroundColor" Value="Transparent" /> | ||
<Setter Property="Text" Value="" /> | ||
<Setter Property="FontSize" Value="15" /> | ||
<Setter Property="TextColor" Value="DimGray" /> | ||
</Style> | ||
|
||
<Style x:Key="arrowButtonNextStyle" TargetType="Button"> | ||
<Setter Property="FontFamily" Value="FontAwesomeSolid" /> | ||
<Setter Property="Text" Value="" /> | ||
<Setter Property="BorderColor" Value="Transparent" /> | ||
<Setter Property="BackgroundColor" Value="Transparent" /> | ||
<Setter Property="FontSize" Value="15" /> | ||
<Setter Property="TextColor" Value="DimGray" /> | ||
</Style> | ||
<Style x:Key="ArrowFooterButtonUpStyle" TargetType="Button"> | ||
<Setter Property="BackgroundColor" Value="Transparent" /> | ||
<Setter Property="FontFamily" Value="FontAwesomeSolid" /> | ||
<Setter Property="FontAttributes" Value="Bold" /> | ||
<Setter Property="FontSize" Value="15" /> | ||
<Setter Property="HorizontalOptions" Value="End" /> | ||
<Setter Property="Text" Value="" /> | ||
<Setter Property="TextColor" Value="DimGray" /> | ||
<Setter Property="VerticalOptions" Value="Center" /> | ||
</Style> | ||
</ResourceDictionary> | ||
</ContentView.Resources> | ||
<Grid | ||
Padding="12,0,12,0" | ||
ColumnDefinitions="*,Auto,Auto" | ||
HorizontalOptions="Fill" | ||
IsVisible="{Binding BindingContext.ShowMonthPicker, Source={x:Reference Header}}" | ||
RowDefinitions="Auto" | ||
VerticalOptions="Start"> | ||
<Label | ||
Grid.Column="0" | ||
FontAttributes="Bold" | ||
FontSize="14" | ||
HorizontalOptions="Start" | ||
Style="{StaticResource HeaderLabelStyle}" | ||
TextColor="{toolkit:AppThemeResource DaysTitleLabelTextColorMinimalistic}" | ||
VerticalOptions="Center"> | ||
<Label.FormattedText> | ||
<FormattedString> | ||
<Span Text="{Binding BindingContext.LayoutUnitText, Source={x:Reference Header}, Mode=TwoWay}" /> | ||
<Span Text=" " /> | ||
<Span Text="{Binding BindingContext.Year, Source={x:Reference Header}, Mode=TwoWay}" /> | ||
</FormattedString> | ||
</Label.FormattedText> | ||
</Label> | ||
<Button | ||
Grid.Column="1" | ||
Command="{Binding BindingContext.PrevLayoutUnitCommand, Source={x:Reference Header}, Mode=OneWay}" | ||
Style="{StaticResource arrowButtonPrevStyle}" /> | ||
<Button | ||
Grid.Column="2" | ||
Command="{Binding BindingContext.NextLayoutUnitCommand, Source={x:Reference Header}, Mode=OneWay}" | ||
Style="{StaticResource arrowButtonNextStyle}" /> | ||
</Grid> | ||
</ContentView> |
10 changes: 10 additions & 0 deletions
10
samples/SampleApp/Controls/DefaultDeviceCalendarHeaders/Windows11CalendarHeader.xaml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
namespace SampleApp.Controls; | ||
|
||
[XamlCompilation(XamlCompilationOptions.Compile)] | ||
public partial class Windows11CalendarHeader : ContentView | ||
{ | ||
public Windows11CalendarHeader() | ||
{ | ||
InitializeComponent(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
global using CommunityToolkit.Mvvm.ComponentModel; | ||
global using CommunityToolkit.Mvvm.Input; | ||
global using SampleApp.Model; | ||
global using SampleApp.ViewModels; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
namespace SampleApp.Helpers; | ||
public static class ServiceHelper | ||
{ | ||
public static IServiceProvider Services { get; private set; } | ||
|
||
public static void Initialize(IServiceProvider serviceProvider) => | ||
Services = serviceProvider; | ||
|
||
public static T GetService<T>() => Services.GetService<T>(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,8 @@ | ||
namespace SampleApp.Model | ||
namespace SampleApp.Model; | ||
|
||
public class AdvancedEventModel | ||
{ | ||
public class AdvancedEventModel | ||
{ | ||
public string Name { get; set; } | ||
public string Description { get; set; } | ||
public DateTime Starting { get; set; } | ||
} | ||
public string Name { get; set; } | ||
public string Description { get; set; } | ||
public DateTime Starting { get; set; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,8 @@ | ||
using System; | ||
namespace SampleApp.Model; | ||
|
||
namespace SampleApp.Model | ||
public class CalendarPickerResult | ||
{ | ||
public class CalendarPickerResult | ||
{ | ||
public bool IsSuccess { get; set; } | ||
public bool IsSuccess { get; set; } | ||
|
||
public DateTime? SelectedDate { get; set; } | ||
} | ||
public DateTime? SelectedDate { get; set; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,9 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
namespace SampleApp.Model; | ||
|
||
namespace SampleApp.Model | ||
public class CalendarRangePickerResult | ||
{ | ||
public class CalendarRangePickerResult | ||
{ | ||
public bool IsSuccess { get; set; } | ||
public List<DateTime> SelectedDates { get; set; } = new List<DateTime>(); | ||
public DateTime? SelectedStartDate { get; set; } | ||
public DateTime? SelectedEndDate { get; set; } | ||
} | ||
public bool IsSuccess { get; set; } | ||
public List<DateTime> SelectedDates { get; set; } = new List<DateTime>(); | ||
public DateTime? SelectedStartDate { get; set; } | ||
public DateTime? SelectedEndDate { get; set; } | ||
} |
Oops, something went wrong.