File tree 2 files changed +23
-6
lines changed
2 files changed +23
-6
lines changed Original file line number Diff line number Diff line change 1
- <?xml version =" 1.0" encoding =" utf-8" ?>
1
+ <?xml version =" 1.0" encoding =" utf-8" ?>
2
2
<ContentPage xmlns =" http://xamarin.com/schemas/2014/forms"
3
3
xmlns : x =" http://schemas.microsoft.com/winfx/2009/xaml"
4
4
x : Class =" Samples.ToastsPage"
8
8
<TableRoot >
9
9
<TableSection Title =" Message" >
10
10
<EntryCell Label =" Value" Text =" {Binding Message}" />
11
- <EntryCell Label =" Text Color" Text =" {Binding MessageTextColor}" />
11
+ <!-- <EntryCell Label="Text Color" Text="{Binding MessageTextColor}" /> -- >
12
12
</TableSection >
13
13
<TableSection Title =" Action Color" >
14
14
<EntryCell Label =" Value" Text =" {Binding ActionText}" />
15
- <EntryCell Label =" Text Color" Text =" {Binding ActionTextColor}" />
15
+ <!-- <EntryCell Label="Text Color" Text="{Binding ActionTextColor}" /> -- >
16
16
</TableSection >
17
17
<TableSection >
18
- <EntryCell Label =" Background Color" Text =" {Binding BackgroundColor}" />
18
+ <SwitchCell Text =" Show on Top" On =" {Binding ShowOnTop}" />
19
+ <!-- <EntryCell Label="Background Color" Text="{Binding BackgroundColor}" />-->
19
20
<EntryCell Label =" Duration (sec)" Text =" {Binding SecondsDuration}" Keyboard =" Numeric" />
20
21
<TextCell Text =" Open Toast" Command =" {Binding Open}" />
21
22
</TableSection >
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ public ToastsViewModel(IUserDialogs dialogs) : base(dialogs)
20
20
this . MessageTextColor = ToHex ( Color . White ) ;
21
21
this . BackgroundColor = ToHex ( Color . Blue ) ;
22
22
23
- this . Open = new Command ( async ( ) =>
23
+ this . Open = new Command ( ( ) =>
24
24
{
25
25
// var icon = await BitmapLoader.Current.LoadFromResource("emoji_cool_small.png", null, null);
26
26
@@ -35,11 +35,12 @@ public ToastsViewModel(IUserDialogs dialogs) : base(dialogs)
35
35
//.SetBackgroundColor(bgColor)
36
36
//.SetMessageTextColor(msgColor)
37
37
. SetDuration ( TimeSpan . FromSeconds ( this . SecondsDuration ) )
38
+ . SetPosition ( this . ShowOnTop ? ToastPosition . Top : ToastPosition . Bottom )
38
39
//.SetIcon(icon)
39
40
. SetAction ( x => x
40
41
. SetText ( this . ActionText )
41
42
//.SetTextColor(actionColor)
42
- . SetAction ( ( ) => dialogs . Alert ( "You clicked the primary button" ) )
43
+ . SetAction ( ( ) => dialogs . Alert ( "You clicked the primary toast button" ) )
43
44
)
44
45
) ;
45
46
} ) ;
@@ -98,6 +99,21 @@ public int SecondsDuration
98
99
}
99
100
100
101
102
+ bool showOnTop ;
103
+ public bool ShowOnTop
104
+ {
105
+ get => this . showOnTop ;
106
+ set
107
+ {
108
+ if ( this . showOnTop == value )
109
+ return ;
110
+
111
+ this . showOnTop = true ;
112
+ this . OnPropertyChanged ( ) ;
113
+ }
114
+ }
115
+
116
+
101
117
string actionText ;
102
118
public string ActionText
103
119
{
You can’t perform that action at this time.
0 commit comments