private void SetTile(CinemaInfo ci, CinemaTileType cinemaType) { if (ci == null) { return; } Tile t = new Tile() { CommandParameter = ci.ID, Margin = new Thickness(12, 12, 0, 0), Height = 210, Width = 210, Foreground = new SolidColorBrush(Colors.White), Background = new ImageBrush() { ImageSource = new BitmapImage(new Uri("Images/Background.png", UriKind.Relative)) } }; Grid g = new Grid(); g.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Auto) }); g.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Star) }); TextBlock tbTopText = new TextBlock() { Text = cinemaType.ToString(), Margin = new Thickness(12), VerticalAlignment = System.Windows.VerticalAlignment.Top }; Grid.SetColumn(tbTopText, 0); Grid.SetRow(tbTopText, 0); g.Children.Add(tbTopText); TextBlock tbBottomText = new TextBlock() { Margin = new Thickness(12), VerticalAlignment = System.Windows.VerticalAlignment.Bottom, TextWrapping = TextWrapping.Wrap }; tbBottomText.Text = ci.Name; t.Click += ActiveTile_Click; Grid.SetColumn(tbBottomText, 0); Grid.SetRow(tbBottomText, 1); g.Children.Add(tbBottomText); t.Content = g; TurnstileFeatherEffect.SetFeatheringIndex(t, tileIndex++); this.wpHubTiles.Children.Add(t); }
private void SetTile(CinemaInfo ci, CinemaTileType cinemaType, double distance = 0) { if (ci == null) { return; } Grid gFront = new Grid(); Image img = new Image() { Source = new BitmapImage(new Uri("Images/CineTileFront.png", UriKind.Relative)) }; gFront.Children.Add(img); TextBlock tbTitle = new TextBlock() { Margin = new Thickness(6), Text = ci.Name, TextWrapping = TextWrapping.Wrap, VerticalAlignment = System.Windows.VerticalAlignment.Bottom }; Grid.SetRow(tbTitle, 1); gFront.Children.Add(tbTitle); switch (cinemaType) { case CinemaTileType.Nearest: gFront.Children.Add(new TextBlock() { Margin = new Thickness(6), Text = String.Format("{0:N2} miles", distance), TextWrapping = TextWrapping.Wrap, VerticalAlignment = System.Windows.VerticalAlignment.Top }); break; default: gFront.Children.Add(new TextBlock() { Margin = new Thickness(6), Text = cinemaType.ToString(), TextWrapping = TextWrapping.Wrap, VerticalAlignment = System.Windows.VerticalAlignment.Top }); break; } RadCustomHubTile t = new RadCustomHubTile() { CommandParameter = ci.ID, Margin = new Thickness(12, 12, 0, 0), Height = 144, Width = 144, FrontContent = gFront, IsFrozen = true }; t.Tap += t_Tap; TurnstileFeatherEffect.SetFeatheringIndex(t, tileIndex++); this.wpHubTiles.Children.Add(t); }