Пример #1
0
        public DataViewChildAlbum()
        {
            Orientation = Hyena.Gui.Canvas.Orientation.Vertical;
            Margin = new Thickness (5);
            Width = 90;
            Spacing = 2;

            Children.Add (img = new DataViewChildImage ());
            Children.Add (
                new TextBlock () {
                    Binder = new Hyena.Data.ObjectBinder () { Property = "DisplayTitle" },
                    UseMarkup = true,
                    TextFormat = "<small>{0}</small>",
                }
            );
            Children.Add (
                new TextBlock () {
                    Binder = new Hyena.Data.ObjectBinder () { Property = "DisplayArtistName" },
                    UseMarkup = true,
                    TextFormat = "<small>{0}</small>",
                    // FIXME non-1.0 opacity causes view's border to be drawn over; bgo#644315
                    Opacity = 1.0
                }
            );

            // Render the prelight just on the cover art, but triggered by being anywhere over the album
            PrelightRenderer = (cr, theme, size, o) => Prelight.Gradient (cr, theme, img.ContentAllocation, o);
        }
Пример #2
0
        public Grid()
        {
            var layout = new DataViewLayoutGrid()
            {
                Fill           = true,
                ChildAllocator = () => {
                    DataViewChildImage img = new DataViewChildImage();
                    return(new StackPanel()
                    {
                        Margin = new Thickness(5),
                        Width = 300,
                        Height = 125,
                        Spacing = 5,
                        Children =
                        {
                            new StackPanel()
                            {
                                Orientation = Orientation.Vertical,
                                Width = 90,
                                Spacing = 5,
                                Children =
                                {
                                    img,
                                    new ColumnCellPodcastStatusIndicator(null)
                                }
                            },
                            new TextBlock()
                            {
                                UseMarkup = true,
                                TextWrap = TextWrap.WordChar,
                                TextGenerator = o =>{
                                    var track = o as TrackInfo;
                                    if (track != null)
                                    {
                                        var episode = PodcastTrackInfo.From(track);
                                        if (episode != null)
                                        {
                                            return "<b>{0}</b>\n<small>{1}\n{2}</small>".FormatEscaped(
                                                track.DisplayTrackTitle, episode.PublishedDate.ToShortDateString(), episode.Description
                                                );
                                        }
                                    }
                                    return "";
                                }
                            }
                        },
                        // Render the prelight just on the cover art, but triggered by being anywhere over the album
                        PrelightRenderer = (cr, theme, size, o) => {
                            Prelight.Gradient(cr, theme, new Rect(img.ContentAllocation.X, img.ContentAllocation.Y, img.ImageSize, img.ImageSize), o);
                        }
                    });
                },
                View = this
            };

            ViewLayout = layout;
        }