private static void InitGridViewItem() { var gridViewItemStyle = new Style(typeof(GridViewItem)) { Setters = { new Setter <GridViewItem>("Template", t => t.Template = Funcs.Create(() => new Grid() { Children = { new ContentPresenter { } .Binding("Content", new TemplateBinding("Content")) .Binding("ContentTemplate", new TemplateBinding("ContentTemplate")) .Binding("ContentTemplateSelector", new TemplateBinding("ContentTemplateSelector")), new Border { BorderBrush = SolidColorBrushHelper.Blue, BorderThickness = new Thickness(2), } .Binding("Visibility", new TemplateBinding("IsSelected", converter: new UnoNativeDefaultProgressBarReverseBoolConverter())), } } ) ), } }; Style.RegisterDefaultStyleForType(typeof(GridViewItem), gridViewItemStyle); }
private static void InitToggleSwitch() { var style = new Style(typeof(Windows.UI.Xaml.Controls.ToggleSwitch)) { Setters = { new Setter <ToggleSwitch>("Template", t => t.Template = Funcs.Create(() => { var nativeToggleButton = new BindableSwitch() .Binding("Checked", new TemplateBinding("IsOn") { Mode = BindingMode.TwoWay }) .Binding("Enabled", new Data.TemplateBinding("IsEnabled")) ; return(nativeToggleButton); } ) ) } }; Style.RegisterDefaultStyleForType(typeof(Windows.UI.Xaml.Controls.ToggleSwitch), style); }
private static void InitFlipViewItem() { var flipViewItemStyle = new Style(typeof(FlipViewItem)) { Setters = { new Setter <FlipViewItem>("Template", t => t.Template = Funcs.Create(() => new Grid() { Children = { new ContentPresenter { } .Binding("Content", new TemplateBinding("Content")) .Binding("ContentTemplate", new TemplateBinding("ContentTemplate")) .Binding("ContentTemplateSelector", new TemplateBinding("ContentTemplateSelector")), } } ) ), } }; Style.RegisterDefaultStyleForType(typeof(FlipViewItem), flipViewItemStyle); }
private static void InitExpander() { var style = new Style(typeof(Expander)) { Setters = { new Setter <Expander>("Template", t => t.Template = new ControlTemplate(() => { return(new StackPanel { Children = { new ToggleButton { } .Binding("IsChecked", new TemplateBinding("IsOpened")) .Binding("Content", new TemplateBinding("HeaderContent")) .Binding("ContentTemplate", new TemplateBinding("HeaderTemplate")), new ContentPresenter { } .Binding("Content", new TemplateBinding("Content")) .Binding("ContentTemplate", new TemplateBinding("ContentTemplate")) } }); } ) ) } }; Style.RegisterDefaultStyleForType(typeof(Expander), style); }
private static void InitFlipView() { #if !__MACOS__ var style = new Style(typeof(Windows.UI.Xaml.Controls.FlipView)) { Setters = { // The order is important for this template, see FlipView.UpdateItems for the // PagedCollectionView type dependency. new Setter <FlipView>("ItemsPanel", t => t.ItemsPanel = new ItemsPanelTemplate(() => new PagedCollectionView() { ShowsHorizontalScrollIndicator = false }) ), new Setter <FlipView>("Template", t => t.Template = new ControlTemplate(() => new ItemsPresenter() ) ) } }; Style.RegisterDefaultStyleForType(typeof(Windows.UI.Xaml.Controls.FlipView), style); #endif }
private static void InitFlyoutPresenter() { var style = new Style(typeof(FlyoutPresenter)) { Setters = { new Setter <FlyoutPresenter>("Template", t => t.Template = Funcs.Create(() => new Border() { Child = new ContentPresenter() .Binding("Content", new TemplateBinding("Content")) .Binding("ContentTemplate", new TemplateBinding("ContentTemplate")) .Binding("Margin", new TemplateBinding("Padding")) .Binding("HorizontalAlignment", new TemplateBinding("HorizontalContentAlignment")) .Binding("VerticalAlignment", new TemplateBinding("VerticalContentAlignment")) } .Binding("Background", new TemplateBinding("Background")) .Binding("BorderBrush", new TemplateBinding("BorderBrush")) .Binding("BorderThickness", new TemplateBinding("BorderThickness")) ) ), new Setter <FlyoutPresenter>("HorizontalContentAlignment", t => t.HorizontalContentAlignment = HorizontalAlignment.Stretch), new Setter <FlyoutPresenter>("VerticalContentAlignment", t => t.VerticalContentAlignment = VerticalAlignment.Stretch) } }; Style.RegisterDefaultStyleForType(typeof(FlyoutPresenter), style); }
private static void InitDatePickerSelector() { #if !__MACOS__ var style = new Style(typeof(Windows.UI.Xaml.Controls.DatePickerSelector)) { Setters = { new Setter <DatePickerSelector>("Template", t => t.Template = new ControlTemplate(() => { return(new Border { Background = SolidColorBrushHelper.White, Margin = new Thickness(5), CornerRadius = 10, Child = new UIDatePicker() }); }) ) } }; Style.RegisterDefaultStyleForType(typeof(Windows.UI.Xaml.Controls.DatePickerSelector), style); #endif }
private static void InitializeDefaultStyles() { if (Uno.UI.FeatureConfiguration.Style.UseUWPDefaultStyles) { #if !NET46 Style.RegisterDefaultStyleForType(typeof(Controls.Button), Uno.UI.GlobalStaticResources.XamlDefaultButton); Style.RegisterDefaultStyleForType(typeof(Controls.TextBox), Uno.UI.GlobalStaticResources.XamlDefaultTextBox); Style.RegisterDefaultStyleForType(typeof(Controls.PasswordBox), Uno.UI.GlobalStaticResources.XamlDefaultPasswordBox); Style.RegisterDefaultStyleForType(typeof(Controls.CheckBox), Uno.UI.GlobalStaticResources.XamlDefaultCheckBox); Style.RegisterDefaultStyleForType(typeof(Controls.RadioButton), Uno.UI.GlobalStaticResources.XamlDefaultRadioButton); Style.RegisterDefaultStyleForType(typeof(Controls.AppBarSeparator), Uno.UI.GlobalStaticResources.XamlAppBarSeparator); Style.RegisterDefaultStyleForType(typeof(Controls.AppBarButton), Uno.UI.GlobalStaticResources.XamlAppBarButton); Style.RegisterDefaultStyleForType(typeof(Controls.AppBarToggleButton), Uno.UI.GlobalStaticResources.XamlAppBarToggleButton); Style.RegisterDefaultStyleForType(typeof(Controls.Frame), Uno.UI.GlobalStaticResources.XamlDefaultFrame); Style.RegisterDefaultStyleForType(typeof(Controls.ProgressBar), Uno.UI.GlobalStaticResources.XamlDefaultProgressBar); Style.RegisterDefaultStyleForType(typeof(Controls.Slider), Uno.UI.GlobalStaticResources.XamlDefaultSlider); Style.RegisterDefaultStyleForType(typeof(Controls.Primitives.ToggleButton), Uno.UI.GlobalStaticResources.XamlDefaultToggleButton); Style.RegisterDefaultStyleForType(typeof(Controls.ToggleSwitch), Uno.UI.GlobalStaticResources.XamlDefaultToggleSwitch); Style.RegisterDefaultStyleForType(typeof(Controls.Pivot), Uno.UI.GlobalStaticResources.XamlDefaultPivot); #if !NETSTANDARD2_0 Style.RegisterDefaultStyleForType(typeof(Controls.AppBar), Uno.UI.GlobalStaticResources.XamlCommandBar); #endif #endif } }
private static void InitPage() { var style = new Style(typeof(Windows.UI.Xaml.Controls.NativePage)) { }; Style.RegisterDefaultStyleForType(typeof(Windows.UI.Xaml.Controls.NativePage), style); }
private static void InitDatePicker() { var style = new Style(typeof(Windows.UI.Xaml.Controls.DatePicker)) { Setters = { new Setter <DatePicker>("Template", t => t.Template = new ControlTemplate(() => new UIDatePicker()) ) } }; Style.RegisterDefaultStyleForType(typeof(Windows.UI.Xaml.Controls.DatePicker), style); }
private static void InitWebView() { var style = new Style(typeof(Windows.UI.Xaml.Controls.WebView)) { Setters = { new Setter<WebView>("Template", t => t.Template = Funcs.Create<_View>(() => (_View)new UnoWKWebView() ) ) } }; Style.RegisterDefaultStyleForType(typeof(Windows.UI.Xaml.Controls.WebView), style); }
private static void InitWebView() { var style = new Style(typeof(Windows.UI.Xaml.Controls.WebView)) { Setters = { new Setter <WebView>("Template", t => t.Template = Funcs.Create(() => new Android.Webkit.WebView(ContextHelper.Current) ) ) } }; Style.RegisterDefaultStyleForType(typeof(Windows.UI.Xaml.Controls.WebView), style); }
private static void InitItemsControl() { var style = new Style(typeof(Windows.UI.Xaml.Controls.ItemsControl)) { Setters = { new Setter <ItemsControl>("Template", t => t.Template = Funcs.Create(() => new ItemsPresenter() .Binding(ItemsPresenter.PaddingProperty.Name, new TemplateBinding(ItemsControl.PaddingProperty.Name)) ) ) } }; Style.RegisterDefaultStyleForType(typeof(Windows.UI.Xaml.Controls.ItemsControl), style); }
private static void InitDatePicker() { var style = new Style(typeof(Windows.UI.Xaml.Controls.DatePicker)) { Setters = { new Setter <DatePicker>("Template", t => t.Template = Funcs.Create(() => { return(new BindableDatePicker(ContextHelper.Current)); }) ) } }; Style.RegisterDefaultStyleForType(typeof(Windows.UI.Xaml.Controls.DatePicker), style); }
private static void InitWebView() { var style = new Style(typeof(Windows.UI.Xaml.Controls.WebView)) { Setters = { //WKWebView should be used where available (8.0+) to avoid memory leaks, UIWebView is used on older versions new Setter <WebView>("Template", t => t.Template = Funcs.Create <UIView>(() => WebView.MustUseWebKitWebView() ? (UIView) new UnoWKWebView() : (UIView) new UnoUIWebView() ) ) } }; Style.RegisterDefaultStyleForType(typeof(Windows.UI.Xaml.Controls.WebView), style); }
private static void InitStructuredContentPresenter() { var style = new Style(typeof(StructuredContentPresenter)) { Setters = { new Setter <StructuredContentPresenter>("Template", pb => pb .Template = new ControlTemplate(() => new ContentControl { Name = "PART_Root", HorizontalContentAlignment = HorizontalAlignment.Stretch, VerticalContentAlignment = VerticalAlignment.Stretch, }) ) } }; Style.RegisterDefaultStyleForType(typeof(StructuredContentPresenter), style); }
private static void InitFlipView() { var style = new Style(typeof(Windows.UI.Xaml.Controls.FlipView)) { Setters = { new Setter <FlipView>("ItemsPanel", t => t.ItemsPanel = new ItemsPanelTemplate(() => new NativePagedView() ) ), new Setter <FlipView>("Template", t => t.Template = new ControlTemplate(() => new ItemsPresenter() ) ) } }; Style.RegisterDefaultStyleForType(typeof(Windows.UI.Xaml.Controls.FlipView), style); }
private static void InitContentControl() { var style = new Style(typeof(ContentControl)) { Setters = { new Setter<ContentControl>("Template", t => t.Template = Funcs.Create(() => new ContentPresenter() .Binding("Content", new TemplateBinding("Content")) .Binding("ContentTemplate", new TemplateBinding("ContentTemplate")) .Binding("Margin", new TemplateBinding("Padding")) .Binding("HorizontalAlignment", new TemplateBinding("HorizontalContentAlignment")) .Binding("VerticalAlignment", new TemplateBinding("VerticalContentAlignment")) ) ), new Setter<ContentControl>("HorizontalContentAlignment", t => t.HorizontalContentAlignment = HorizontalAlignment.Left), new Setter<ContentControl>("VerticalContentAlignment", t => t.VerticalContentAlignment = VerticalAlignment.Top) } }; Style.RegisterDefaultStyleForType(typeof(ContentControl), style); }
private static void InitFlipView() { var style = new Style(typeof(Windows.UI.Xaml.Controls.FlipView)) { Setters = { new Setter <FlipView>("Template", t => t.Template = new ControlTemplate(() => new ItemsPresenter() ) ), new Setter <FlipView>("ItemsPanel", t => t.ItemsPanel = new ItemsPanelTemplate(() => new PagedCollectionView() { ShowsHorizontalScrollIndicator = false }) ) } }; Style.RegisterDefaultStyleForType(typeof(Windows.UI.Xaml.Controls.FlipView), style); }