public static IFluentItem <Image> Stretch(this IFluentItem <Image> item, Stretch stretch) { FluentItem <Image> fluentItem = (FluentItem <Image>)item; fluentItem.Element.Stretch = stretch; return(item); }
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); }
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); }