Esempio n. 1
0
        void ListViewItemsSelected(object sender, SelectedItemChangedEventArgs e)
        {
            var todoItem = (TodoItem)e.SelectedItem;
            var todoPage = new TodoItemPage {
                BindingContext = todoItem
            };

            Navigation.PushAsync(todoPage);
        }
Esempio n. 2
0
        public TodoItemList()
        {
            InitializeComponent();

            ToolbarItem tbi = null;

            if (Device.OS == TargetPlatform.iOS)
            {
                tbi = new ToolbarItem("+", null, () =>
                {
                    var todoItem = new TodoItem();
                    var todoPage = new TodoItemPage {
                        BindingContext = todoItem
                    };
                    Navigation.PushAsync(todoPage);
                });
            }
            if (Device.OS == TargetPlatform.Android)
            { // BUG: Android doesn't support the icon being null
                tbi = new ToolbarItem("+", "plus", () =>
                {
                    var todoItem = new TodoItem();
                    var todoPage = new TodoItemPage {
                        BindingContext = todoItem
                    };
                    Navigation.PushAsync(todoPage);
                });
            }
            if (Device.OS == TargetPlatform.WinPhone || Device.OS == TargetPlatform.Windows)
            {
                tbi = new ToolbarItem("Add", "add.png", () =>
                {
                    var todoItem = new TodoItem();
                    var todoPage = new TodoItemPage {
                        BindingContext = todoItem
                    };
                    Navigation.PushAsync(todoPage);
                });
            }

            ToolbarItems.Add(tbi);
        }