コード例 #1
0
        static TileNavBaseItemViewModel CreateItem(string displayName, string[] Images)
        {
            TileNavBaseItemViewModel vm = new TileNavBaseItemViewModel()
            {
                DisplayName  = displayName,
                Color        = Colors[random.Next(Colors.Length)],
                Image        = new BitmapImage(new Uri(Images[random.Next(Images.Length)], UriKind.RelativeOrAbsolute)),
                ContentImage = new BitmapImage(new Uri(ContentImages[random.Next(ContentImages.Length)], UriKind.RelativeOrAbsolute))
            };

            return(vm);
        }
コード例 #2
0
        public static IEnumerable <TileNavBaseItemViewModel> CreateActions()
        {
            var actions = new List <TileNavBaseItemViewModel>();

            for (int i = 1; i < 5; i++)
            {
                TileNavBaseItemViewModel action = CreateItem(String.Format("Action {0}", i), ItemImages);
                if (i < 3)
                {
                    action.Size = TileSize.Small;
                }
                actions.Add(action);
            }
            return(actions);
        }
コード例 #3
0
        public static IEnumerable <TileNavBaseItemViewModel> CreateCategories()
        {
            var categories = new List <TileNavBaseItemViewModel>();

            for (int i = 1; i < 6; i++)
            {
                TileNavBaseItemViewModel category = CreateItem(String.Format("Category {0}", i), ItemImages);
                for (int j = 1; j < 5; j++)
                {
                    TileNavBaseItemViewModel item = CreateItem(String.Format("Item {0}.{1}", i, j), ItemImages);
                    for (int k = 1; k < 4; k++)
                    {
                        TileNavBaseItemViewModel subItem = CreateItem(String.Format("SubItem {0}.{1}.{2}", i, j, k), SubItemImages);
                        item.Items.Add(subItem);
                    }
                    category.Items.Add(item);
                }
                categories.Add(category);
            }
            return(categories);
        }
コード例 #4
0
        protected virtual void OnNavigationMessage(NavigationMessage message)
        {
            switch (message.MessageType)
            {
            case NavigationMessageType.New:
                TileNavBaseItemViewModel vm = message.Source as TileNavBaseItemViewModel;
                if (vm != null && vm.IsSelected)
                {
                    NavigationService.Navigate("TileNavDetailsView", vm);
                    if (Selected != null)
                    {
                        Selected.IsSelected = false;
                    }
                    Selected = vm;
                }
                break;

            case NavigationMessageType.Back:
                OnBackCommand();
                break;
            }
        }