public static IFluentTemplateItem Size(this IFluentTemplateItem templateItem, double width, double height) { templateItem.Set(FrameworkElement.WidthProperty, width); templateItem.Set(FrameworkElement.HeightProperty, height); return(templateItem); }
public static IFluentTemplateItem Center(this IFluentTemplateItem templateItem) { templateItem.Set(FrameworkElement.HorizontalAlignmentProperty, HorizontalAlignment.Center); templateItem.Set(FrameworkElement.VerticalAlignmentProperty, VerticalAlignment.Center); return(templateItem); }
public static DataTemplate AsDataTemplate <T>(this IFluentTemplateItem templateItem) { FrameworkElementFactory factory = (templateItem as FluentTemplateItem)?.GetFactory(); return(new DataTemplate(typeof(T)) { VisualTree = factory }); }
public static IFluentTemplateItem Contains <T>(this IFluentTemplateItem templateItem) where T : FrameworkElement { FluentTemplateItem child = new FluentTemplateItem(typeof(T)); templateItem.Contains(child); return(child); }
public static ControlTemplate AsControlTemplate <T>(this IFluentTemplateItem templateItem) where T : FrameworkElement { FrameworkElementFactory factory = (templateItem as FluentTemplateItem)?.GetFactory(); return(new ControlTemplate(typeof(T)) { VisualTree = factory }); }
public static IFluentStyle PanelTemplate(this IFluentStyle fluentStyle, IFluentTemplateItem template) { var fluentTemplateItem = template as FluentTemplateItem; FrameworkElementFactory factory = fluentTemplateItem.GetFactory(); factory.SetValue(Panel.IsItemsHostProperty, true); fluentStyle.Set(ItemsControl.ItemsPanelProperty, new ItemsPanelTemplate { VisualTree = factory }); return(fluentStyle); }
public static IFluentTemplateItem Bind(this IFluentTemplateItem templateItem, DependencyProperty property, string path, IValueConverter converter = null, object targetNullValue = null) { templateItem.Binding(property, path, converter, targetNullValue); return(templateItem); }
public static IFluentTemplateItem Set(this IFluentTemplateItem templateItem, DependencyProperty property, object value) { templateItem.SetValue(property, value); return(templateItem); }
public static IFluentTemplateItem TemplateBinding(this IFluentTemplateItem templateItem, DependencyProperty property, DependencyProperty templateProperty, IValueConverter converter) { templateItem.Binding(property, templateProperty, converter); return(templateItem); }
public static IFluentTemplateItem TemplateBinding(this IFluentTemplateItem templateItem, DependencyProperty property, DependencyProperty templateProperty, Func <object, object> lambda) { IValueConverter converter = lambda != null ? new LambdaConverter(lambda) : null; return(templateItem.TemplateBinding(property, templateProperty, converter)); }
public static IFluentTemplateItem TemplateBinding(this IFluentTemplateItem templateItem, DependencyProperty property, DependencyProperty templateProperty) { return(templateItem.TemplateBinding(property, templateProperty, (IValueConverter)null)); }
public static IFluentTemplateItem Contains(this IFluentTemplateItem templateItem, IFluentTemplateItem child) { templateItem.AddChild(child); return(templateItem); }
public void Add(IFluentTemplateItem item) { this.children.Add(item); }
public void AddChild(IFluentTemplateItem child) { this.itemFactory.AppendChild((child as FluentTemplateItem).GetFactory()); }