-
-
Notifications
You must be signed in to change notification settings - Fork 162
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
Some updates for MaterialTextField & MaterialSelectionControl #411
base: develop
Are you sure you want to change the base?
Changes from all commits
55050c7
3778bb6
9029c22
9030908
c6a2cce
42ad95f
d22288e
4269ab3
1b373cc
b5a0c4b
dd89bec
ecfa121
ed06502
b24d1fc
967637a
003214d
d645373
7d2515b
6fb0d4b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,13 @@ | |
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<None Remove="Images\eye-slash-solid-18dp.svg" /> | ||
<None Remove="Images\eye-solid-18dp.svg" /> | ||
Comment on lines
+13
to
+14
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove these lines :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have added new icon for password show hide example. |
||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<EmbeddedResource Include="Images\eye-slash-solid-18dp.svg" /> | ||
<EmbeddedResource Include="Images\eye-solid-18dp.svg" /> | ||
<EmbeddedResource Include="Images\slideshow-black-18dp.svg" /> | ||
</ItemGroup> | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
using System.Collections.Generic; | ||
using System.Windows.Input; | ||
using Xamarin.Forms; | ||
using XamSvg.XamForms; | ||
using XF.Material.Forms.UI; | ||
using XF.Material.Forms.UI.Dialogs; | ||
|
||
namespace MaterialMvvmSample.ViewModels | ||
|
@@ -16,13 +18,45 @@ public class MaterialTextFieldViewModel : BaseViewModel | |
}; | ||
|
||
public ICommand OpenCustomChoiceCommand { get; } | ||
public ICommand CustomChoiceParameterUsingCommand { get; } | ||
|
||
public MaterialTextFieldViewModel() | ||
{ | ||
OpenCustomChoiceCommand = new Command(async () => | ||
{ | ||
await MaterialDialog.Instance.AlertAsync("Command tapped. Do what you want ! You can open a custom popup, ask some data, and update the textfield text with this data"); | ||
}); | ||
|
||
CustomChoiceParameterUsingCommand = new Command<MaterialTextField>(async (e) => | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. a viewmodel should not receive a UI object. Using MaterialTextField, which is a UI object, as a parameter is a very bad practive. Instead create a new class with the interesting parameters only. To change a property of a ui item, use binding and datatriggers instead. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That is a sample for testing ChoiceCommandParameter. I use this approach for example hide show datepicker for cross platform. Whay do you think that is not good practive? |
||
{ | ||
|
||
if (e != null) | ||
{ | ||
|
||
if (e.InputType == MaterialTextFieldInputType.Password) | ||
{ | ||
e.InputType = MaterialTextFieldInputType.Plain; | ||
e.TrailingIconTintColor = Color.Gray; | ||
e.TrailingIcon = new SvgImageSource() | ||
{ | ||
Svg = "res:images.eye-solid-18dp" | ||
}; | ||
} | ||
else | ||
{ | ||
e.InputType = MaterialTextFieldInputType.Password; | ||
e.TrailingIconTintColor = Color.Black; | ||
e.TrailingIcon = new SvgImageSource() | ||
{ | ||
Svg = "res:images.eye-slash-solid-18dp" | ||
}; | ||
} | ||
} | ||
|
||
}); | ||
|
||
|
||
|
||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,56 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||
xmlns:material="clr-namespace:XF.Material.Forms.UI;assembly=XF.Material" | ||
x:Class="MaterialMvvmSample.Views.CheckboxesView"> | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<ContentPage | ||
x:Class="MaterialMvvmSample.Views.CheckboxesView" | ||
xmlns="http://xamarin.com/schemas/2014/forms" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||
xmlns:material="clr-namespace:XF.Material.Forms.UI;assembly=XF.Material"> | ||
<ContentPage.Content> | ||
<StackLayout Orientation="Vertical"> | ||
<material:MaterialCheckbox Text="My Material Checkbox" /> | ||
|
||
<material:MaterialCheckbox | ||
HorizontalOptions="Center" | ||
HorizontalSize="Auto" | ||
Text="My Material Checkbox Horizontal Size Auto" /> | ||
|
||
<material:MaterialCheckbox | ||
HorizontalSize="Fill" | ||
Text="My Material Checkbox Letter Spacing" | ||
TextLetterSpacing="5" /> | ||
|
||
<material:MaterialRadioButtonGroup | ||
BackgroundColor="Bisque" | ||
HorizontalOptions="Fill" | ||
Orientation="Vertical" | ||
TextLetterSpacing="5"> | ||
|
||
<material:MaterialRadioButtonGroup.Choices> | ||
<x:Array Type="{x:Type x:String}"> | ||
<x:String>Radio 1</x:String> | ||
<x:String>Radio 2</x:String> | ||
</x:Array> | ||
</material:MaterialRadioButtonGroup.Choices> | ||
|
||
</material:MaterialRadioButtonGroup> | ||
|
||
<material:MaterialCheckboxGroup | ||
BackgroundColor="LightYellow" | ||
HorizontalOptions="Center" | ||
Orientation="Horizontal"> | ||
|
||
<material:MaterialCheckboxGroup.Choices> | ||
<x:Array Type="{x:Type x:String}"> | ||
<x:String>Checkbox 1</x:String> | ||
<x:String>Checkbox 2</x:String> | ||
</x:Array> | ||
</material:MaterialCheckboxGroup.Choices> | ||
|
||
</material:MaterialCheckboxGroup> | ||
|
||
|
||
</StackLayout> | ||
|
||
|
||
|
||
|
||
</ContentPage.Content> | ||
</ContentPage> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why has this been removed ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you do not remove "savedInstanceState" Rg.Plugins.Popup gives compile error.