Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/xmlns definition #247

Merged
merged 2 commits into from
Jan 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
<pages:BasePage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:pages="clr-namespace:CommunityToolkit.Maui.Sample.Pages"
xmlns:converters="clr-namespace:CommunityToolkit.Maui.Converters;assembly=CommunityToolkit.Maui"
xmlns:toolkit="http://schemas.microsoft.com/dotnet/2022/maui/tookit"
x:Class="CommunityToolkit.Maui.Sample.Pages.Alerts.SnackbarPage">

<pages:BasePage.Resources>
<ResourceDictionary>
<converters:ColorToColorForTextConverter x:Key="ColorToColorForTextConverter"/>
<toolkit:ColorToColorForTextConverter x:Key="ColorToColorForTextConverter"/>
</ResourceDictionary>
</pages:BasePage.Resources>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
x:Class="CommunityToolkit.Maui.Sample.Pages.Behaviors.CharactersValidationBehaviorPage"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:mct="clr-namespace:CommunityToolkit.Maui.Behaviors;assembly=CommunityToolkit.Maui"
xmlns:toolkit="http://schemas.microsoft.com/dotnet/2022/maui/tookit"
xmlns:pages="clr-namespace:CommunityToolkit.Maui.Sample.Pages">
<pages:BasePage.Resources>
<Style x:Key="InvalidEntryStyle"
Expand Down Expand Up @@ -59,39 +59,39 @@
<Label Text="Type characters for validation behavior according to the settings you set upon."/>
<Entry Placeholder="Type characters...">
<Entry.Behaviors>
<mct:CharactersValidationBehavior CharacterType="{Binding SelectedItem, Source={x:Reference CharacterTypePicker}}"
Flags="ValidateOnValueChanged"
InvalidStyle="{StaticResource InvalidEntryStyle}"
ValidStyle="{StaticResource ValidEntryStyle}"
MaximumCharacterTypeCount="{Binding Text, Source={x:Reference MaximumCharacterCountEntry}}"
MinimumCharacterTypeCount="{Binding Text, Source={x:Reference MinimumCharacterCountEntry}}"/>
</Entry.Behaviors>
</Entry>
<toolkit:CharactersValidationBehavior CharacterType="{Binding SelectedItem, Source={x:Reference CharacterTypePicker}}"
Flags="ValidateOnValueChanged"
InvalidStyle="{StaticResource InvalidEntryStyle}"
ValidStyle="{StaticResource ValidEntryStyle}"
MaximumCharacterTypeCount="{Binding Text, Source={x:Reference MaximumCharacterCountEntry}}"
MinimumCharacterTypeCount="{Binding Text, Source={x:Reference MinimumCharacterCountEntry}}"/>
</Entry.Behaviors>
</Entry>

<Label Text="The same but styling handled by visual state manager."/>
<Entry Placeholder="Type characters...">
<Entry.Behaviors>
<mct:CharactersValidationBehavior Flags="ValidateOnValueChanged"
CharacterType="{Binding SelectedItem, Source={x:Reference CharacterTypePicker}}"
MaximumCharacterTypeCount="{Binding Text, Source={x:Reference MaximumCharacterCountEntry}}"
MinimumCharacterTypeCount="{Binding Text, Source={x:Reference MinimumCharacterCountEntry}}"/>
</Entry.Behaviors>
<Label Text="The same but styling handled by visual state manager."/>
<Entry Placeholder="Type characters...">
<Entry.Behaviors>
<toolkit:CharactersValidationBehavior Flags="ValidateOnValueChanged"
CharacterType="{Binding SelectedItem, Source={x:Reference CharacterTypePicker}}"
MaximumCharacterTypeCount="{Binding Text, Source={x:Reference MaximumCharacterCountEntry}}"
MinimumCharacterTypeCount="{Binding Text, Source={x:Reference MinimumCharacterCountEntry}}"/>
</Entry.Behaviors>

<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Valid">
<VisualState.Setters>
<Setter Property="TextColor" Value="Green"/>
</VisualState.Setters>
</VisualState>
<VisualState x:Name="Invalid">
<VisualState.Setters>
<Setter Property="TextColor" Value="IndianRed"/>
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</Entry>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Valid">
<VisualState.Setters>
<Setter Property="TextColor" Value="Green"/>
</VisualState.Setters>
</VisualState>
<VisualState x:Name="Invalid">
<VisualState.Setters>
<Setter Property="TextColor" Value="IndianRed"/>
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</Entry>

</VerticalStackLayout>
</pages:BasePage.Content>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<pages:BasePage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:mct="clr-namespace:CommunityToolkit.Maui.Behaviors;assembly=CommunityToolkit.Maui"
xmlns:toolkit="http://schemas.microsoft.com/dotnet/2022/maui/tookit"
xmlns:pages="clr-namespace:CommunityToolkit.Maui.Sample.Pages"
x:Class="CommunityToolkit.Maui.Sample.Pages.Behaviors.EmailValidationBehaviorPage">

Expand All @@ -23,7 +23,7 @@
HorizontalOptions="FillAndExpand"
VerticalOptions="Center">
<Entry.Behaviors>
<mct:EmailValidationBehavior
<toolkit:EmailValidationBehavior
x:Name="EmailValidator"
Flags="ValidateOnValueChanged"
DecorationFlags="Trim"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:pages="clr-namespace:CommunityToolkit.Maui.Sample.Pages"
xmlns:mct="clr-namespace:CommunityToolkit.Maui.Behaviors;assembly=CommunityToolkit.Maui"
xmlns:toolkit="http://schemas.microsoft.com/dotnet/2022/maui/tookit"
xmlns:vm="clr-namespace:CommunityToolkit.Maui.Sample.ViewModels.Behaviors"
x:Class="CommunityToolkit.Maui.Sample.Pages.Behaviors.EventToCommandBehaviorPage"
x:TypeArguments="vm:EventToCommandBehaviorViewModel">
Expand All @@ -14,7 +14,7 @@
TextColor="White"
BackgroundColor="{StaticResource NormalButtonBackgroundColor}">
<Button.Behaviors>
<mct:EventToCommandBehavior
<toolkit:EventToCommandBehavior
EventName="Clicked"
Command="{Binding IncrementCommand}" />
</Button.Behaviors>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<pages:BasePage
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:mct="clr-namespace:CommunityToolkit.Maui.Behaviors;assembly=CommunityToolkit.Maui"
xmlns:toolkit="http://schemas.microsoft.com/dotnet/2022/maui/tookit"
xmlns:pages="clr-namespace:CommunityToolkit.Maui.Sample.Pages"
x:Class="CommunityToolkit.Maui.Sample.Pages.Behaviors.MaskedBehaviorPage">
<ScrollView>
Expand All @@ -12,21 +12,21 @@

<Entry Keyboard="Numeric">
<Entry.Behaviors>
<mct:MaskedBehavior Mask="XX-XX-XX" />
<toolkit:MaskedBehavior Mask="XX-XX-XX" />
</Entry.Behaviors>
</Entry>
<Label Padding="10,0,10,50" FontSize="Small" Text="e.g. Sort code 'XX-XX-XX'" />

<Entry Keyboard="Numeric">
<Entry.Behaviors>
<mct:MaskedBehavior Mask="AA-AA-AA" UnMaskedCharacter="A" />
<toolkit:MaskedBehavior Mask="AA-AA-AA" UnMaskedCharacter="A" />
</Entry.Behaviors>
</Entry>
<Label Padding="10,0,10,50" FontSize="Small" Text="e.g. Sort code 'AA-AA-AA'" />

<Entry Keyboard="Numeric">
<Entry.Behaviors>
<mct:MaskedBehavior Mask="XXXX XXXX XXXX XXXX" />
<toolkit:MaskedBehavior Mask="XXXX XXXX XXXX XXXX" />
</Entry.Behaviors>
</Entry>
<Label Padding="10,0,10,50" FontSize="Small">
Expand All @@ -40,14 +40,14 @@

<Entry Keyboard="Numeric" Placeholder="dd/mm/yyyy">
<Entry.Behaviors>
<mct:MaskedBehavior Mask="XX/XX/XXXX" />
<toolkit:MaskedBehavior Mask="XX/XX/XXXX" />
</Entry.Behaviors>
</Entry>
<Label Padding="10,0,10,50" FontSize="Small" Text="e.g. Date 'XX/XX/XXXX'" />

<Entry Keyboard="Numeric" Placeholder="hh:mm">
<Entry.Behaviors>
<mct:MaskedBehavior Mask="XX:XX" />
<toolkit:MaskedBehavior Mask="XX:XX" />
</Entry.Behaviors>
</Entry>
<Label Padding="10,0,10,50" FontSize="Small">
Expand All @@ -61,14 +61,14 @@

<Entry Keyboard="Numeric">
<Entry.Behaviors>
<mct:MaskedBehavior Mask="XXX-XX-XXXX" />
<toolkit:MaskedBehavior Mask="XXX-XX-XXXX" />
</Entry.Behaviors>
</Entry>
<Label Padding="10,0,10,50" FontSize="Small" Text="e.g. Social Security Number 'XXX-XX-XXXX'" />

<Entry Keyboard="Numeric">
<Entry.Behaviors>
<mct:MaskedBehavior Mask="(XXX) XXX-XXXX" />
<toolkit:MaskedBehavior Mask="(XXX) XXX-XXXX" />
</Entry.Behaviors>
</Entry>
<Label Padding="10,0,10,50" FontSize="Small" Text="e.g. Phone Number '(XXX) XXX-XXXX'" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<pages:BasePage
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:mct="clr-namespace:CommunityToolkit.Maui.Behaviors;assembly=CommunityToolkit.Maui"
xmlns:toolkit="http://schemas.microsoft.com/dotnet/2022/maui/tookit"
xmlns:pages="clr-namespace:CommunityToolkit.Maui.Sample.Pages"
xmlns:vm="clr-namespace:CommunityToolkit.Maui.Sample.ViewModels.Behaviors"
x:Class="CommunityToolkit.Maui.Sample.Pages.Behaviors.MaxLengthReachedBehaviorPage"
Expand Down Expand Up @@ -48,8 +48,9 @@
MaxLength="{Binding Path=Text, Source={x:Reference MaxLengthSetting}}"
Margin="{StaticResource ContentPadding}">
<Entry.Behaviors>
<mct:MaxLengthReachedBehavior MaxLengthReached="MaxLengthReachedBehavior_MaxLengthReached"
ShouldDismissKeyboardAutomatically="{Binding Path=IsToggled, Source={x:Reference AutoDismissKeyboardSetting}}" />
<toolkit:MaxLengthReachedBehavior
MaxLengthReached="MaxLengthReachedBehavior_MaxLengthReached"
ShouldDismissKeyboardAutomatically="{Binding Path=IsToggled, Source={x:Reference AutoDismissKeyboardSetting}}" />
</Entry.Behaviors>
</Entry>

Expand All @@ -66,8 +67,9 @@
MaxLength="{Binding Path=Text, Source={x:Reference MaxLengthSetting}}"
Margin="{StaticResource ContentPadding}">
<Entry.Behaviors>
<mct:MaxLengthReachedBehavior Command="{Binding MaxLengthReachedCommand}"
ShouldDismissKeyboardAutomatically="{Binding Path=IsToggled, Source={x:Reference AutoDismissKeyboardSetting}}" />
<toolkit:MaxLengthReachedBehavior
Command="{Binding MaxLengthReachedCommand}"
ShouldDismissKeyboardAutomatically="{Binding Path=IsToggled, Source={x:Reference AutoDismissKeyboardSetting}}" />
</Entry.Behaviors>
</Entry>

Expand Down
Loading