Beispiel #1
0
        public static IFluentTemplateItem Size(this IFluentTemplateItem templateItem, double width, double height)
        {
            templateItem.Set(FrameworkElement.WidthProperty, width);
            templateItem.Set(FrameworkElement.HeightProperty, height);

            return(templateItem);
        }
Beispiel #2
0
        public static IFluentTemplateItem Center(this IFluentTemplateItem templateItem)
        {
            templateItem.Set(FrameworkElement.HorizontalAlignmentProperty, HorizontalAlignment.Center);
            templateItem.Set(FrameworkElement.VerticalAlignmentProperty, VerticalAlignment.Center);

            return(templateItem);
        }
Beispiel #3
0
        public static DataTemplate AsDataTemplate <T>(this IFluentTemplateItem templateItem)
        {
            FrameworkElementFactory factory = (templateItem as FluentTemplateItem)?.GetFactory();

            return(new DataTemplate(typeof(T))
            {
                VisualTree = factory
            });
        }
Beispiel #4
0
        public static IFluentTemplateItem Contains <T>(this IFluentTemplateItem templateItem)
            where T : FrameworkElement
        {
            FluentTemplateItem child = new FluentTemplateItem(typeof(T));

            templateItem.Contains(child);

            return(child);
        }
Beispiel #5
0
        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);
        }
Beispiel #7
0
        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);
        }
Beispiel #8
0
        public static IFluentTemplateItem Set(this IFluentTemplateItem templateItem, DependencyProperty property, object value)
        {
            templateItem.SetValue(property, value);

            return(templateItem);
        }
Beispiel #9
0
        public static IFluentTemplateItem TemplateBinding(this IFluentTemplateItem templateItem, DependencyProperty property, DependencyProperty templateProperty, IValueConverter converter)
        {
            templateItem.Binding(property, templateProperty, converter);

            return(templateItem);
        }
Beispiel #10
0
        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));
        }
Beispiel #11
0
 public static IFluentTemplateItem TemplateBinding(this IFluentTemplateItem templateItem, DependencyProperty property, DependencyProperty templateProperty)
 {
     return(templateItem.TemplateBinding(property, templateProperty, (IValueConverter)null));
 }
Beispiel #12
0
        public static IFluentTemplateItem Contains(this IFluentTemplateItem templateItem, IFluentTemplateItem child)
        {
            templateItem.AddChild(child);

            return(templateItem);
        }
Beispiel #13
0
 public void Add(IFluentTemplateItem item)
 {
     this.children.Add(item);
 }
Beispiel #14
0
 public void AddChild(IFluentTemplateItem child)
 {
     this.itemFactory.AppendChild((child as FluentTemplateItem).GetFactory());
 }