summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Controls
diff options
context:
space:
mode:
authorRui Marinho <me@ruimarinho.net>2017-01-30 12:29:27 +0000
committerKangho Hur <kangho.hur@samsung.com>2017-03-24 13:16:43 +0900
commitb7541bc2872c304e88ffa6441db1902049d5be93 (patch)
treeabf1b5af36548461932cecc13ea8613889156dd5 /Xamarin.Forms.Controls
parent3831017d8fe2cb9b085009ee5a22c676694e8213 (diff)
downloadxamarin-forms-b7541bc2872c304e88ffa6441db1902049d5be93.tar.gz
xamarin-forms-b7541bc2872c304e88ffa6441db1902049d5be93.tar.bz2
xamarin-forms-b7541bc2872c304e88ffa6441db1902049d5be93.zip
[MacOS] Fixes to ToolbarItems (#728)
* [MacOS] Support toolbar item property changes * [UITest,MacOS] Support query by button hardcoded * [UITests] Add and fix more toolbar tests
Diffstat (limited to 'Xamarin.Forms.Controls')
-rw-r--r--Xamarin.Forms.Controls/ControlGalleryPages/ToolbarItems.cs34
1 files changed, 20 insertions, 14 deletions
diff --git a/Xamarin.Forms.Controls/ControlGalleryPages/ToolbarItems.cs b/Xamarin.Forms.Controls/ControlGalleryPages/ToolbarItems.cs
index 3e98fc88..b3b3521e 100644
--- a/Xamarin.Forms.Controls/ControlGalleryPages/ToolbarItems.cs
+++ b/Xamarin.Forms.Controls/ControlGalleryPages/ToolbarItems.cs
@@ -7,43 +7,49 @@ namespace Xamarin.Forms.Controls
public class ToolbarItems : ContentPage
{
bool _isEnable = false;
- public ToolbarItems ()
+ public ToolbarItems()
{
- var label = new Label { Text = "Hello ContentPage", AutomationId ="label_id" };
- var tb1 = new ToolbarItem ("tb1", "menuIcon.png", () => {
+ var label = new Label { Text = "Hello ContentPage", AutomationId = "label_id" };
+
+ var command = new Command((obj) =>
+ {
+ label.Text = "tb4";
+ }, (obj) => _isEnable);
+ var tb1 = new ToolbarItem("tb1", "menuIcon.png", () =>
+ {
label.Text = "tb1";
}, ToolbarItemOrder.Primary);
tb1.IsEnabled = _isEnable;
tb1.AutomationId = "toolbaritem_primary";
- tb1.IsEnabled = _isEnable;
- var tb2 = new ToolbarItem ("tb2", null, () => {
+ var tb2 = new ToolbarItem("tb2", null, () =>
+ {
label.Text = "tb2";
}, ToolbarItemOrder.Primary);
tb2.AutomationId = "toolbaritem_primary2";
- var tb3 = new ToolbarItem ("tb3", "bank.png", () => {
+ var tb3 = new ToolbarItem("tb3", "bank.png", () =>
+ {
label.Text = "tb3";
+ _isEnable = !_isEnable;
+ command.ChangeCanExecute();
}, ToolbarItemOrder.Secondary);
tb3.AutomationId = "toolbaritem_secondary";
- var tb4 = new ToolbarItem ();
+ var tb4 = new ToolbarItem();
tb4.Text = "tb4";
tb4.Order = ToolbarItemOrder.Secondary;
- tb4.Command = new Command( (obj)=> {
- _isEnable = true;
- label.Text = "tb4";
- (tb4.Command as Command).ChangeCanExecute();
- },(obj) => _isEnable);
+ tb4.Command = command;
tb4.AutomationId = "toolbaritem_secondary2";
-
+
ToolbarItems.Add(tb1);
ToolbarItems.Add(tb2);
ToolbarItems.Add(tb3);
ToolbarItems.Add(tb4);
- Content = new StackLayout {
+ Content = new StackLayout
+ {
Children = {
label
}