public static IFluentItem <T> Field <T>(this IFluentItem <T> fluentItem, out T field) where T : FrameworkElement { field = fluentItem.Element; return(fluentItem); }
public static IFluentItem <T> CenterHorizontally <T>(this IFluentItem <T> item) where T : FrameworkElement { Get(item).HorizontalAlignment = HorizontalAlignment.Center; return(item); }
public static IFluentItem <T> Right <T>(this IFluentItem <T> item) where T : FrameworkElement { Get(item).HorizontalAlignment = HorizontalAlignment.Right; return(item); }
public static IFluentItem <T> StretchVertically <T>(this IFluentItem <T> item) where T : FrameworkElement { Get(item).VerticalAlignment = VerticalAlignment.Stretch; return(item); }
public static IFluentItem <T> Bottom <T>(this IFluentItem <T> item) where T : FrameworkElement { Get(item).VerticalAlignment = VerticalAlignment.Bottom; return(item); }
public static IFluentItem <T> UseStyle <T>(this IFluentItem <T> item, IFluentStyle style) where T : FrameworkElement { Get(item).Style = style.AsStyle <T>(); return(item); }
public static IFluentItem <T> StretchHorizontal <T>(this IFluentItem <T> item) where T : FrameworkElement { Get(item).HorizontalAlignment = HorizontalAlignment.Stretch; return(item); }
public static IFluentItem <T> Set <T>(this IFluentItem <T> item, DependencyProperty property, object value) where T : FrameworkElement { Get(item).SetValue(property, value); return(item); }
public static IFluentItem <StackPanel> Stack(this IFluentItem <StackPanel> fluentItem, IFluentItem item) { fluentItem.AddChild(item); fluentItem.Element.Children.Add(item.Element); return(fluentItem); }
public static IFluentItem <DockPanel> DockLeft <T>(this IFluentItem <DockPanel> dockPanel, IFluentItem <T> child) where T : FrameworkElement { Dock(dockPanel, child, System.Windows.Controls.Dock.Left); return(dockPanel); }
public static IFluentItem <TabControl> Tab(this IFluentItem <TabControl> fluentItem, IFluentItem <TabItem> fluentTabItem) { fluentItem.AddChild(fluentTabItem); fluentItem.Element.Items.Add(fluentTabItem.Element); return(fluentItem); }
public static IFluentItem <HeaderedContentControl> Header(this IFluentItem <HeaderedContentControl> fluentItem, IFluentItem header) { fluentItem.Element.Header = header.Element; fluentItem.AddChild(header); return(fluentItem); }
public static IFluentItem <T> Bind <T>(this IFluentItem <T> item, IFluentBinding fluentBinding) where T : FrameworkElement { item.AddBinding(fluentBinding); return(item); }
public static IFluentItem <T> On <T>(this IFluentItem <T> item, RoutedEvent ev, RoutedEventHandler handler) where T : FrameworkElement { item.AddHandler(ev, handler); return(item); }
public MainMenuView() { this.fluentItem = this .AsFluent <Grid>() .Set(Control.BackgroundProperty, Theme.ThemeColors.Control.Normal) .Set(StackPanel.OrientationProperty, Orientation.Horizontal) .Set(Control.FontFamilyProperty, new FontFamily("SEGOE MDL2 assets")) .Set(Control.FontSizeProperty, 18d) .Set(FrameworkElement.HeightProperty, 80d) .DefaultCellSize("*", "*") .Cell(GridCellExtensions.Create() .Contains(new Button() .AsFluent() .Contains("\xE90B") .Bind(BindingExtensions .OneTime(ButtonBase.CommandProperty) .With(nameof(RootViewModel.OpenSearchViewCommand))))) .Cell(GridCellExtensions.Create() .Column(1) .Contains(new Button() .AsFluent() .Contains("\xE8D6") .Bind(BindingExtensions .OneTime(ButtonBase.CommandProperty) .With(nameof(RootViewModel.OpenPlayerViewCommand))))) .Cell(GridCellExtensions.Create() .Column(2) .Contains(new Button() .AsFluent() .Contains("\xE74F"))); }
public static IFluentItem <T> UseStyle <T>(this IFluentItem <T> item, string key) where T : FrameworkElement { Get(item).Style = Application.Current.Resources[key] as Style; return(item); }
public static IFluentItem <T> DataContext <T>(this IFluentItem <T> fluentItem, object dataContext) where T : FrameworkElement { fluentItem.Element.DataContext = dataContext; return(fluentItem); }
public static IFluentItem <T> Margin <T>(this IFluentItem <T> item, float margin) where T : FrameworkElement { Get(item).Margin = new Thickness(margin); return(item); }
public static IFluentItem <T> Margin <T>(this IFluentItem <T> item, Thickness margin) where T : FrameworkElement { Get(item).Margin = margin; return(item); }
public static IFluentItem <DockPanel> Dock <T>(this IFluentItem <DockPanel> dockPanel, IFluentItem <T> child) where T : FrameworkElement { Dock(dockPanel, child, null); return(dockPanel); }
public static IFluentItem <T> Size <T>(this IFluentItem <T> item, int width, int height) where T : FrameworkElement { item.Element.Width = width; item.Element.Height = height; return(item); }
public static IFluentItem <Image> Stretch(this IFluentItem <Image> item, Stretch stretch) { FluentItem <Image> fluentItem = (FluentItem <Image>)item; fluentItem.Element.Stretch = stretch; return(item); }
/// <summary> /// Add a new cell to the parent grid, you can specify row and columns using dedicated extension methods /// </summary> /// <example> /// <code> /// .Cell(GridCellExtensions.Create() /// .Row(1).Column(2).Span(2, 1) /// .Contains( ...)) /// </code> /// </example> public static IFluentItem <Grid> Cell(this IFluentItem <Grid> fluentItem, IGridCell cell) { (fluentItem as GridFluentItem)?.SetupCell(cell); cell.HostInGrid(fluentItem.Element); fluentItem.AddChild(cell.Content); return(fluentItem); }
public static IGridCell Column(this IFluentItem <Grid> item, GridLength width) { IGridCell cell = GridCellExtensions.Create(); cell.Width = width; cell.Column = item.Element.ColumnDefinitions.Count; return(cell); }
public static IFluentItem <Grid> DefaultCellSize(this IFluentItem <Grid> item, double width, double height) { GridFluentItem gridFluentItem = new GridFluentItem(item); gridFluentItem.DefaultWidth = new GridLength(width, GridUnitType.Pixel); gridFluentItem.DefaultHeight = new GridLength(height, GridUnitType.Pixel); return(gridFluentItem); }
public static IGridCell Row(this IFluentItem <Grid> item, GridLength height) { IGridCell cell = GridCellExtensions.Create(); cell.Height = height; cell.Row = item.Element.RowDefinitions.Count; return(cell); }
public static IFluentItem <T> SubDataContext <T>(this IFluentItem <T> fluentItem, string path) where T : FrameworkElement { fluentItem.Bind(BindingExtensions .OneWay(FrameworkElement.DataContextProperty) .With(path)); return(fluentItem); }
public static IFluentItem <T> Margin <T>(this IFluentItem <T> item, double left, double top, double right, double bottom) where T : FrameworkElement { T element = Get(item); element.Margin = new Thickness(left, top, right, bottom); return(item); }
public static IFluentItem <T> Contains <T>(this IFluentItem <T> item, IFluentItem content) where T : ContentControl { item.AddChild(content); item.Element.Content = content.Element; return(item); }
public static IFluentItem <T> MarginBottom <T>(this IFluentItem <T> item, double bottom) where T : FrameworkElement { T element = Get(item); Thickness margin = element.Margin; element.Margin = new Thickness(margin.Left, margin.Top, margin.Right, bottom); return(item); }