public RadioButtonStyle() { this.AddRange(new[] { new Style(x => x.OfType <RadioButton>()) { Setters = new[] { new Setter(Button.TemplateProperty, ControlTemplate.Create <RadioButton>(this.Template)), }, }, new Style(x => x.OfType <RadioButton>().Template().Id("checkMark")) { Setters = new[] { new Setter(Shape.IsVisibleProperty, false), }, }, new Style(x => x.OfType <RadioButton>().Class(":checked").Template().Id("checkMark")) { Setters = new[] { new Setter(Shape.IsVisibleProperty, true), }, }, }); }
public ButtonStyle() { this.AddRange(new[] { new Style(x => x.OfType <Button>()) { Setters = new[] { new Setter(Button.TemplateProperty, ControlTemplate.Create <Button>(this.Template)), new Setter(Button.HorizontalContentAlignmentProperty, HorizontalAlignment.Center), new Setter(Button.VerticalContentAlignmentProperty, VerticalAlignment.Center), }, }, new Style(x => x.OfType <Button>().Template().Id("border")) { Setters = new[] { new Setter(Button.BackgroundProperty, new SolidColorBrush(0xffdddddd)), new Setter(Button.BorderBrushProperty, new SolidColorBrush(0xff707070)), new Setter(Button.BorderThicknessProperty, 2.0), new Setter(Button.ForegroundProperty, new SolidColorBrush(0xff000000)), }, }, new Style(x => x.OfType <Button>().Class(":pointerover").Template().Id("border")) { Setters = new[] { new Setter(Button.BackgroundProperty, new SolidColorBrush(0xffbee6fd)), new Setter(Button.BorderBrushProperty, new SolidColorBrush(0xff3c7fb1)), }, }, new Style(x => x.OfType <Button>().Class(":pointerover").Class(":pressed").Template().Id("border")) { Setters = new[] { new Setter(Button.BackgroundProperty, new SolidColorBrush(0xffc4e5f6)), }, }, new Style(x => x.OfType <Button>().Class(":pressed").Template().Id("border")) { Setters = new[] { new Setter(Button.BorderBrushProperty, new SolidColorBrush(0xffff628b)), }, }, new Style(x => x.OfType <Button>().Class(":disabled").Template().Id("border")) { Setters = new[] { new Setter(Button.ForegroundProperty, new SolidColorBrush(0xff7f7f7f)), }, }, }); }
public ContentControlStyle() { this.AddRange(new[] { new Style(x => x.OfType <ContentControl>()) { Setters = new[] { new Setter(ContentControl.TemplateProperty, ControlTemplate.Create <ContentControl>(this.Template)), }, }, }); }
public ScrollViewerStyle() { this.AddRange(new[] { new Style(x => x.OfType <ScrollViewer>()) { Setters = new[] { new Setter(ScrollViewer.TemplateProperty, ControlTemplate.Create <ScrollViewer>(this.Template)), }, }, }); }
public ItemsControlStyle() { this.AddRange(new[] { new Style(x => x.OfType <ItemsControl>()) { Setters = new[] { new Setter(Button.TemplateProperty, ControlTemplate.Create <ItemsControl>(this.Template)), }, }, }); }
private ControlTemplate GetTemplate() { return(ControlTemplate.Create <ContentControl>(parent => { return new Border { Background = new Perspex.Media.SolidColorBrush(0xffffffff), Content = new ContentPresenter { [~ContentPresenter.ContentProperty] = parent[~ContentControl.ContentProperty], } }; })); }
public GridSplitterStyle() { this.AddRange(new[] { new Style(x => x.OfType <GridSplitter>()) { Setters = new[] { new Setter(GridSplitter.TemplateProperty, ControlTemplate.Create <GridSplitter>(this.Template)), new Setter(GridSplitter.WidthProperty, 4), }, }, }); }
public TreeViewItemStyle() { this.AddRange(new[] { new Style(x => x.OfType <TreeViewItem>()) { Setters = new[] { new Setter(Button.TemplateProperty, ControlTemplate.Create <TreeViewItem>(this.Template)), }, }, new Style(x => x.OfType <TreeViewItem>().Template().Id("header")) { Setters = new[] { new Setter(Border.PaddingProperty, new Thickness(2)), }, }, new Style(x => x.OfType <TreeViewItem>().Class(":selected").Template().Id("header")) { Setters = new[] { new Setter(TreeViewItem.BackgroundProperty, new SolidColorBrush(0xff086f9e)), new Setter(TreeViewItem.ForegroundProperty, Brushes.White), }, }, new Style(x => x.OfType <TreeViewItem>().Template().OfType <ToggleButton>().Class("expander")) { Setters = new[] { new Setter(ToggleButton.TemplateProperty, ControlTemplate.Create <ToggleButton>(this.ToggleButtonTemplate)), }, }, new Style(x => x.OfType <TreeViewItem>().Template().OfType <ToggleButton>().Class("expander").Class(":checked").Template().OfType <Path>()) { Setters = new[] { new Setter(ToggleButton.RenderTransformProperty, new RotateTransform(45)), }, }, new Style(x => x.OfType <TreeViewItem>().Class(":empty").Template().OfType <ToggleButton>().Class("expander")) { Setters = new[] { new Setter(ToggleButton.IsVisibleProperty, false), }, }, }); }
public WindowStyle() { this.AddRange(new[] { new Style(x => x.OfType <Window>()) { Setters = new[] { new Setter(Window.TemplateProperty, ControlTemplate.Create <Window>(this.Template)), new Setter(Window.FontFamilyProperty, "Segoe UI"), new Setter(Window.FontSizeProperty, 12.0), }, }, }); }
public TreeViewStyle() { this.AddRange(new[] { new Style(x => x.OfType <TreeView>()) { Setters = new[] { new Setter(TreeView.TemplateProperty, ControlTemplate.Create <TreeView>(this.Template)), new Setter(TreeView.BorderBrushProperty, Brushes.Black), new Setter(TreeView.BorderThicknessProperty, 1.0), }, }, }); }
public ScrollBarStyle() { this.AddRange(new[] { new Style(x => x.OfType <ScrollBar>()) { Setters = new[] { new Setter(ScrollBar.TemplateProperty, ControlTemplate.Create <ScrollBar>(this.Template)), }, }, new Style(x => x.OfType <ScrollBar>().Class(":horizontal")) { Setters = new[] { new Setter(ScrollBar.TemplateProperty, ControlTemplate.Create <ScrollBar>(this.Template)), new Setter(ScrollBar.HeightProperty, 10.0), }, }, new Style(x => x.OfType <ScrollBar>().Class(":horizontal").Template().Id("thumb")) { Setters = new[] { new Setter(Thumb.MinWidthProperty, 10.0), }, }, new Style(x => x.OfType <ScrollBar>().Class(":vertical")) { Setters = new[] { new Setter(ScrollBar.TemplateProperty, ControlTemplate.Create <ScrollBar>(this.Template)), new Setter(ScrollBar.WidthProperty, 10.0), }, }, new Style(x => x.OfType <ScrollBar>().Class(":vertical").Template().Id("thumb")) { Setters = new[] { new Setter(Thumb.MinHeightProperty, 10.0), }, }, }); }
private Control Template(ScrollBar control) { return(new Border { Background = Brushes.Silver, Content = new Track { [~Track.MinimumProperty] = control[~ScrollBar.MinimumProperty], [~Track.MaximumProperty] = control[~ScrollBar.MaximumProperty], [~~Track.ValueProperty] = control[~ScrollBar.ValueProperty], [~Track.ViewportSizeProperty] = control[~ScrollBar.ViewportSizeProperty], [~Track.OrientationProperty] = control[~ScrollBar.OrientationProperty], Thumb = new Thumb { Id = "thumb", Template = ControlTemplate.Create <Thumb>(this.ThumbTemplate), }, }, }); }
public Window() { IPlatformRenderInterface factory = Locator.Current.GetService <IPlatformRenderInterface>(); this.CreateWindow(); Size clientSize = this.ClientSize; this.LayoutManager = new LayoutManager(this); this.RenderManager = new RenderManager(); this.renderer = factory.CreateRenderer(this.Handle, (int)clientSize.Width, (int)clientSize.Height); this.inputManager = Locator.Current.GetService <IInputManager>(); this.Template = ControlTemplate.Create <Window>(this.DefaultTemplate); this.LayoutManager.LayoutNeeded.Subscribe(x => { WindowsDispatcher.CurrentDispatcher.BeginInvoke( DispatcherPriority.Render, () => { this.LayoutManager.ExecuteLayoutPass(); this.renderer.Render(this); this.RenderManager.RenderFinished(); }); }); this.RenderManager.RenderNeeded .Where(_ => !this.LayoutManager.LayoutQueued) .Subscribe(x => { WindowsDispatcher.CurrentDispatcher.BeginInvoke( DispatcherPriority.Render, () => { if (!this.LayoutManager.LayoutQueued) { this.renderer.Render(this); this.RenderManager.RenderFinished(); } }); }); }
public ListBoxItemStyle() { this.AddRange(new[] { new Style(x => x.OfType <ListBoxItem>()) { Setters = new[] { new Setter(ListBoxItem.TemplateProperty, ControlTemplate.Create <ListBoxItem>(this.Template)), }, }, new Style(x => x.OfType <ListBoxItem>().Class(":selected").Template().Id("border")) { Setters = new[] { new Setter(ListBoxItem.BackgroundProperty, new SolidColorBrush(0xff086f9e)), new Setter(ListBoxItem.ForegroundProperty, Brushes.White), }, }, }); }
public TabStripStyle() { this.AddRange(new[] { new Style(x => x.OfType <TabStrip>()) { Setters = new[] { new Setter(TabStrip.TemplateProperty, ControlTemplate.Create <TabStrip>(this.Template)), }, }, new Style(x => x.OfType <TabStrip>().Template().OfType <StackPanel>()) { Setters = new[] { new Setter(StackPanel.GapProperty, 16.0), new Setter(StackPanel.OrientationProperty, Orientation.Horizontal), }, }, }); }
public TextBoxStyle() { this.AddRange(new[] { new Style(x => x.OfType <TextBox>()) { Setters = new[] { new Setter(TextBox.TemplateProperty, ControlTemplate.Create <TextBox>(this.Template)), new Setter(TextBox.BorderBrushProperty, new SolidColorBrush(0xff707070)), new Setter(TextBox.BorderThicknessProperty, 2.0), }, }, new Style(x => x.OfType <TextBox>().Class(":focus").Template().Id("border")) { Setters = new[] { new Setter(TextBox.BorderBrushProperty, Brushes.Black), }, } }); }
public TabItemStyle() { this.AddRange(new[] { new Style(x => x.OfType <TabItem>()) { Setters = new[] { new Setter(TextBlock.FontSizeProperty, 28.7), new Setter(Control.ForegroundProperty, Brushes.Gray), new Setter(TabItem.TemplateProperty, ControlTemplate.Create <TabItem>(this.Template)), }, }, new Style(x => x.OfType <TabItem>().Class(":selected")) { Setters = new[] { new Setter(Control.ForegroundProperty, Brushes.Black), }, }, }); }