コード例 #1
0
        public static IFluentItem <Image> Stretch(this IFluentItem <Image> item, Stretch stretch)
        {
            FluentItem <Image> fluentItem = (FluentItem <Image>)item;

            fluentItem.Element.Stretch = stretch;

            return(item);
        }
コード例 #2
0
        private static void Dock <T>(IFluentItem <DockPanel> dockPanel, IFluentItem <T> child, Dock?dock)
            where T : FrameworkElement
        {
            dockPanel.AddChild(child);

            FluentItem <DockPanel> item = (FluentItem <DockPanel>)dockPanel;
            T childItem = ((FluentItem <T>)child).Element;

            if (dock.HasValue)
            {
                DockPanel.SetDock(childItem, dock.Value);
            }

            item.Element.Children.Add(childItem);
        }
コード例 #3
0
        public static IFluentItem <Image> Source(this IFluentItem <Image> item, string source)
        {
            string packedUri = $"pack://application:,,,/{Assembly.GetCallingAssembly().GetName()};component/{source}";

            BitmapImage bitmapImage = new BitmapImage();

            bitmapImage.BeginInit();
            bitmapImage.UriSource = new Uri(packedUri);
            bitmapImage.EndInit();

            FluentItem <Image> fluentItem = (FluentItem <Image>)item;

            fluentItem.Element.Source = bitmapImage;

            return(item);
        }