58 changed files with 133 additions and 2467 deletions
@ -1,29 +1,4 @@ |
|||
<Application x:Class="XamlTestApplicationPcl.XamlTestApp" |
|||
xmlns="https://github.com/perspex" |
|||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> |
|||
<Application.Styles> |
|||
<StyleInclude Source="resource://application/XamlTestApplicationPcl/XamlTestApplication.FocusAdorner.paml"/> |
|||
<StyleInclude Source="resource://application/XamlTestApplicationPcl/XamlTestApplication.Button.paml"/> |
|||
<StyleInclude Source="resource://application/XamlTestApplicationPcl/XamlTestApplication.Carousel.paml"/> |
|||
<StyleInclude Source="resource://application/XamlTestApplicationPcl/XamlTestApplication.CheckBox.paml"/> |
|||
<StyleInclude Source="resource://application/XamlTestApplicationPcl/XamlTestApplication.DropDown.paml"/> |
|||
<StyleInclude Source="resource://application/XamlTestApplicationPcl/XamlTestApplication.GridSplitter.paml"/> |
|||
<StyleInclude Source="resource://application/XamlTestApplicationPcl/XamlTestApplication.ItemsControl.paml"/> |
|||
<StyleInclude Source="resource://application/XamlTestApplicationPcl/XamlTestApplication.ListBox.paml"/> |
|||
<StyleInclude Source="resource://application/XamlTestApplicationPcl/XamlTestApplication.ListBoxItem.paml"/> |
|||
<StyleInclude Source="resource://application/XamlTestApplicationPcl/XamlTestApplication.Menu.paml"/> |
|||
<StyleInclude Source="resource://application/XamlTestApplicationPcl/XamlTestApplication.MenuItem.paml"/> |
|||
<StyleInclude Source="resource://application/XamlTestApplicationPcl/XamlTestApplication.PopupRoot.paml"/> |
|||
<StyleInclude Source="resource://application/XamlTestApplicationPcl/XamlTestApplication.RadioButton.paml"/> |
|||
<StyleInclude Source="resource://application/XamlTestApplicationPcl/XamlTestApplication.ScrollBar.paml"/> |
|||
<StyleInclude Source="resource://application/XamlTestApplicationPcl/XamlTestApplication.ScrollViewer.paml"/> |
|||
<StyleInclude Source="resource://application/XamlTestApplicationPcl/XamlTestApplication.TabControl.paml"/> |
|||
<StyleInclude Source="resource://application/XamlTestApplicationPcl/XamlTestApplication.TabItem.paml"/> |
|||
<StyleInclude Source="resource://application/XamlTestApplicationPcl/XamlTestApplication.TabStrip.paml"/> |
|||
<StyleInclude Source="resource://application/XamlTestApplicationPcl/XamlTestApplication.TextBox.paml"/> |
|||
<StyleInclude Source="resource://application/XamlTestApplicationPcl/XamlTestApplication.ToggleButton.paml"/> |
|||
<StyleInclude Source="resource://application/XamlTestApplicationPcl/XamlTestApplication.TreeView.paml"/> |
|||
<StyleInclude Source="resource://application/XamlTestApplicationPcl/XamlTestApplication.TreeViewItem.paml"/> |
|||
<StyleInclude Source="resource://application/XamlTestApplicationPcl/XamlTestApplication.Window.paml"/> |
|||
</Application.Styles> |
|||
</Application> |
|||
@ -1 +1 @@ |
|||
Subproject commit 99d24a3019504b901742496fffbdbb549a7245ab |
|||
Subproject commit 06f74f30af7945467101fad95a1759a5b70a2b55 |
|||
@ -1,110 +0,0 @@ |
|||
// Copyright (c) The Perspex Project. All rights reserved.
|
|||
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
|||
|
|||
using System.Linq; |
|||
using Perspex.Collections; |
|||
using Perspex.Controls; |
|||
using Perspex.Controls.Presenters; |
|||
using Perspex.Controls.Primitives; |
|||
using Perspex.Controls.Shapes; |
|||
using Perspex.Controls.Templates; |
|||
using Perspex.Layout; |
|||
using Perspex.Media; |
|||
using Perspex.Styling; |
|||
|
|||
namespace Perspex.Themes.Default |
|||
{ |
|||
/// <summary>
|
|||
/// The default style for the <see cref="Button"/> control.
|
|||
/// </summary>
|
|||
public class ButtonStyle : Styles |
|||
{ |
|||
/// <summary>
|
|||
/// Initializes a new instance of the <see cref="ButtonStyle"/> class.
|
|||
/// </summary>
|
|||
public ButtonStyle() |
|||
{ |
|||
AddRange(new[] |
|||
{ |
|||
new Style(x => x.OfType<Button>()) |
|||
{ |
|||
Setters = new[] |
|||
{ |
|||
new Setter(TemplatedControl.BackgroundProperty, new SolidColorBrush(0xffaaaaaa)), |
|||
new Setter(TemplatedControl.BorderBrushProperty, new SolidColorBrush(0xffaaaaaa)), |
|||
new Setter(TemplatedControl.BorderThicknessProperty, 2), |
|||
new Setter(TemplatedControl.ForegroundProperty, new SolidColorBrush(0xff000000)), |
|||
new Setter(Control.FocusAdornerProperty, new FuncTemplate<IControl>(FocusAdornerTemplate)), |
|||
new Setter(TemplatedControl.TemplateProperty, new FuncControlTemplate<Button>(Template)), |
|||
new Setter(ContentControl.HorizontalContentAlignmentProperty, HorizontalAlignment.Center), |
|||
new Setter(ContentControl.VerticalContentAlignmentProperty, VerticalAlignment.Center), |
|||
}, |
|||
}, |
|||
new Style(x => x.OfType<Button>().Class(":pointerover").Template().Name("border")) |
|||
{ |
|||
Setters = new[] |
|||
{ |
|||
new Setter(TemplatedControl.BorderBrushProperty, new SolidColorBrush(0xff888888)), |
|||
}, |
|||
}, |
|||
new Style(x => x.OfType<Button>().Class(":pointerover").Class(":pressed").Template().Name("border")) |
|||
{ |
|||
Setters = new[] |
|||
{ |
|||
new Setter(TemplatedControl.BorderBrushProperty, new SolidColorBrush(0xff888888)), |
|||
new Setter(TemplatedControl.BackgroundProperty, new SolidColorBrush(0xff888888)), |
|||
}, |
|||
}, |
|||
new Style(x => x.OfType<Button>().Class(":disabled").Template().Name("contentPresenter")) |
|||
{ |
|||
Setters = new[] |
|||
{ |
|||
new Setter(Visual.OpacityProperty, 0.5), |
|||
}, |
|||
}, |
|||
}); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// The default template for the <see cref="Button"/> control's focus adorner.
|
|||
/// </summary>
|
|||
/// <returns>The root of the instantiated template.</returns>
|
|||
public static Control FocusAdornerTemplate() |
|||
{ |
|||
return new Rectangle |
|||
{ |
|||
Stroke = Brushes.Black, |
|||
StrokeThickness = 1, |
|||
StrokeDashArray = new PerspexList<double>(1, 2), |
|||
Margin = new Thickness(3.5), |
|||
}; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// The default template for the <see cref="Button"/> control.
|
|||
/// </summary>
|
|||
/// <param name="control">The control being styled.</param>
|
|||
/// <returns>The root of the instantiated template.</returns>
|
|||
public static Control Template(Button control) |
|||
{ |
|||
Border border = new Border |
|||
{ |
|||
Name = "border", |
|||
Padding = new Thickness(3), |
|||
Child = new ContentPresenter |
|||
{ |
|||
Name = "contentPresenter", |
|||
[~ContentPresenter.ContentProperty] = control[~ContentControl.ContentProperty], |
|||
[~TextBlock.ForegroundProperty] = control[~TemplatedControl.ForegroundProperty], |
|||
[~Layoutable.HorizontalAlignmentProperty] = control[~ContentControl.HorizontalContentAlignmentProperty], |
|||
[~Layoutable.VerticalAlignmentProperty] = control[~ContentControl.VerticalContentAlignmentProperty], |
|||
}, |
|||
[~Border.BackgroundProperty] = control[~TemplatedControl.BackgroundProperty], |
|||
[~Border.BorderBrushProperty] = control[~TemplatedControl.BorderBrushProperty], |
|||
[~Border.BorderThicknessProperty] = control[~TemplatedControl.BorderThicknessProperty], |
|||
}; |
|||
|
|||
return border; |
|||
} |
|||
} |
|||
} |
|||
@ -1,53 +0,0 @@ |
|||
// Copyright (c) The Perspex Project. All rights reserved.
|
|||
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
|||
|
|||
using System.Linq; |
|||
using Perspex.Controls; |
|||
using Perspex.Controls.Presenters; |
|||
using Perspex.Controls.Primitives; |
|||
using Perspex.Controls.Templates; |
|||
using Perspex.Styling; |
|||
|
|||
namespace Perspex.Themes.Default |
|||
{ |
|||
/// <summary>
|
|||
/// The default style for the <see cref="Carousel"/> control.
|
|||
/// </summary>
|
|||
public class CarouselStyle : Styles |
|||
{ |
|||
/// <summary>
|
|||
/// Initializes a new instance of the <see cref="CarouselStyle"/> class.
|
|||
/// </summary>
|
|||
public CarouselStyle() |
|||
{ |
|||
AddRange(new[] |
|||
{ |
|||
new Style(x => x.OfType<Carousel>()) |
|||
{ |
|||
Setters = new[] |
|||
{ |
|||
new Setter(TemplatedControl.TemplateProperty, new FuncControlTemplate<Carousel>(Template)), |
|||
}, |
|||
}, |
|||
}); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// The default template for the <see cref="Carousel"/> control.
|
|||
/// </summary>
|
|||
/// <param name="control">The control being styled.</param>
|
|||
/// <returns>The root of the instantiated template.</returns>
|
|||
public static Control Template(Carousel control) |
|||
{ |
|||
return new CarouselPresenter |
|||
{ |
|||
Name = "itemsPresenter", |
|||
MemberSelector = control.MemberSelector, |
|||
[~ItemsPresenter.ItemsProperty] = control[~ItemsControl.ItemsProperty], |
|||
[~ItemsPresenter.ItemsPanelProperty] = control[~ItemsControl.ItemsPanelProperty], |
|||
[~CarouselPresenter.SelectedIndexProperty] = control[~SelectingItemsControl.SelectedIndexProperty], |
|||
[~CarouselPresenter.TransitionProperty] = control[~Carousel.TransitionProperty], |
|||
}; |
|||
} |
|||
} |
|||
} |
|||
@ -1,110 +0,0 @@ |
|||
// Copyright (c) The Perspex Project. All rights reserved.
|
|||
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
|||
|
|||
using System.Linq; |
|||
using Perspex.Controls; |
|||
using Perspex.Controls.Presenters; |
|||
using Perspex.Controls.Primitives; |
|||
using Perspex.Controls.Shapes; |
|||
using Perspex.Controls.Templates; |
|||
using Perspex.Layout; |
|||
using Perspex.Media; |
|||
using Perspex.Styling; |
|||
|
|||
namespace Perspex.Themes.Default |
|||
{ |
|||
using Controls = Controls.Controls; |
|||
|
|||
/// <summary>
|
|||
/// The default style for the <see cref="CheckBox"/> control.
|
|||
/// </summary>
|
|||
public class CheckBoxStyle : Styles |
|||
{ |
|||
/// <summary>
|
|||
/// Initializes a new instance of the <see cref="CheckBoxStyle"/> class.
|
|||
/// </summary>
|
|||
public CheckBoxStyle() |
|||
{ |
|||
AddRange(new[] |
|||
{ |
|||
new Style(x => x.OfType<CheckBox>()) |
|||
{ |
|||
Setters = new[] |
|||
{ |
|||
new Setter(TemplatedControl.TemplateProperty, new FuncControlTemplate<CheckBox>(Template)), |
|||
}, |
|||
}, |
|||
new Style(x => x.OfType<CheckBox>().Template().Name("checkMark")) |
|||
{ |
|||
Setters = new[] |
|||
{ |
|||
new Setter(Visual.IsVisibleProperty, false), |
|||
}, |
|||
}, |
|||
new Style(x => x.OfType<CheckBox>().Class(":checked").Template().Name("checkMark")) |
|||
{ |
|||
Setters = new[] |
|||
{ |
|||
new Setter(Visual.IsVisibleProperty, true), |
|||
}, |
|||
}, |
|||
}); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// The default template for a <see cref="CheckBox"/> control.
|
|||
/// </summary>
|
|||
/// <param name="control">The control being styled.</param>
|
|||
/// <returns>The root of the instantiated template.</returns>
|
|||
public static Control Template(CheckBox control) |
|||
{ |
|||
Border result = new Border |
|||
{ |
|||
[~Border.BackgroundProperty] = control[~TemplatedControl.BackgroundProperty], |
|||
Child = new Grid |
|||
{ |
|||
ColumnDefinitions = new ColumnDefinitions |
|||
{ |
|||
new ColumnDefinition(GridLength.Auto), |
|||
new ColumnDefinition(new GridLength(1, GridUnitType.Star)), |
|||
}, |
|||
Children = new Controls |
|||
{ |
|||
new Border |
|||
{ |
|||
Name = "checkBorder", |
|||
BorderBrush = new SolidColorBrush(0xff333333), |
|||
BorderThickness = 2, |
|||
Width = 18, |
|||
Height = 18, |
|||
VerticalAlignment = VerticalAlignment.Center, |
|||
[Grid.ColumnProperty] = 0, |
|||
}, |
|||
new Path |
|||
{ |
|||
Name = "checkMark", |
|||
Fill = new SolidColorBrush(0xff333333), |
|||
Width = 11, |
|||
Height = 10, |
|||
Stretch = Stretch.Uniform, |
|||
HorizontalAlignment = HorizontalAlignment.Center, |
|||
VerticalAlignment = VerticalAlignment.Center, |
|||
Data = StreamGeometry.Parse("M 1145.607177734375,430 C1145.607177734375,430 1141.449951171875,435.0772705078125 1141.449951171875,435.0772705078125 1141.449951171875,435.0772705078125 1139.232177734375,433.0999755859375 1139.232177734375,433.0999755859375 1139.232177734375,433.0999755859375 1138,434.5538330078125 1138,434.5538330078125 1138,434.5538330078125 1141.482177734375,438 1141.482177734375,438 1141.482177734375,438 1141.96875,437.9375 1141.96875,437.9375 1141.96875,437.9375 1147,431.34619140625 1147,431.34619140625 1147,431.34619140625 1145.607177734375,430 1145.607177734375,430 z"), |
|||
[Grid.ColumnProperty] = 0, |
|||
}, |
|||
new ContentPresenter |
|||
{ |
|||
Name = "contentPresenter", |
|||
Margin = new Thickness(4, 0, 0, 0), |
|||
VerticalAlignment = VerticalAlignment.Center, |
|||
[~ContentPresenter.ContentProperty] = control[~ContentControl.ContentProperty], |
|||
[Grid.ColumnProperty] = 1, |
|||
}, |
|||
}, |
|||
}, |
|||
}; |
|||
|
|||
return result; |
|||
} |
|||
} |
|||
} |
|||
@ -1,53 +0,0 @@ |
|||
// Copyright (c) The Perspex Project. All rights reserved.
|
|||
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
|||
|
|||
using System.Linq; |
|||
using Perspex.Controls; |
|||
using Perspex.Controls.Presenters; |
|||
using Perspex.Controls.Primitives; |
|||
using Perspex.Controls.Templates; |
|||
using Perspex.Styling; |
|||
|
|||
namespace Perspex.Themes.Default |
|||
{ |
|||
/// <summary>
|
|||
/// The default style for the <see cref="ContentControl"/> control.
|
|||
/// </summary>
|
|||
public class ContentControlStyle : Styles |
|||
{ |
|||
/// <summary>
|
|||
/// Initializes a new instance of the <see cref="ContentControlStyle"/> class.
|
|||
/// </summary>
|
|||
public ContentControlStyle() |
|||
{ |
|||
AddRange(new[] |
|||
{ |
|||
new Style(x => x.OfType<ContentControl>()) |
|||
{ |
|||
Setters = new[] |
|||
{ |
|||
new Setter(TemplatedControl.TemplateProperty, new FuncControlTemplate<ContentControl>(Template)), |
|||
}, |
|||
}, |
|||
}); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// The default template for a <see cref="ContentControl"/> control.
|
|||
/// </summary>
|
|||
/// <param name="control">The control being styled.</param>
|
|||
/// <returns>The root of the instantiated template.</returns>
|
|||
public static Control Template(ContentControl control) |
|||
{ |
|||
return new Border |
|||
{ |
|||
[~Border.BackgroundProperty] = control[~TemplatedControl.BackgroundProperty], |
|||
Child = new ContentPresenter |
|||
{ |
|||
Name = "contentPresenter", |
|||
[~ContentPresenter.ContentProperty] = control[~ContentControl.ContentProperty], |
|||
} |
|||
}; |
|||
} |
|||
} |
|||
} |
|||
@ -1,47 +0,0 @@ |
|||
// Copyright (c) The Perspex Project. All rights reserved.
|
|||
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
|||
|
|||
using Perspex.Styling; |
|||
|
|||
namespace Perspex.Themes.Default |
|||
{ |
|||
/// <summary>
|
|||
/// The default Perspex theme.
|
|||
/// </summary>
|
|||
public class DefaultTheme : Styles |
|||
{ |
|||
/// <summary>
|
|||
/// Initializes a new instance of the <see cref="DefaultTheme"/> class.
|
|||
/// </summary>
|
|||
public DefaultTheme() |
|||
{ |
|||
Add(new FocusAdornerStyle()); |
|||
|
|||
Add(new ButtonStyle()); |
|||
Add(new CheckBoxStyle()); |
|||
Add(new ContentControlStyle()); |
|||
Add(new CarouselStyle()); |
|||
Add(new DropDownStyle()); |
|||
Add(new GridSplitterStyle()); |
|||
Add(new ItemsControlStyle()); |
|||
Add(new ListBoxStyle()); |
|||
Add(new ListBoxItemStyle()); |
|||
Add(new MenuStyle()); |
|||
Add(new MenuItemStyle()); |
|||
Add(new PopupRootStyle()); |
|||
Add(new ProgressBarStyle()); |
|||
Add(new RadioButtonStyle()); |
|||
Add(new ScrollBarStyle()); |
|||
Add(new ScrollViewerStyle()); |
|||
Add(new TabControlStyle()); |
|||
Add(new TabItemStyle()); |
|||
Add(new TabStripStyle()); |
|||
Add(new TextBoxStyle()); |
|||
Add(new ToggleButtonStyle()); |
|||
Add(new ToolTipStyle()); |
|||
Add(new TreeViewStyle()); |
|||
Add(new TreeViewItemStyle()); |
|||
Add(new WindowStyle()); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,26 @@ |
|||
<Styles xmlns="https://github.com/perspex"> |
|||
<StyleInclude Source="resource://application/Perspex.Themes.Default/Perspex.Themes.Default.FocusAdorner.paml"/> |
|||
|
|||
<StyleInclude Source="resource://application/Perspex.Themes.Default/Perspex.Themes.Default.Button.paml"/> |
|||
<StyleInclude Source="resource://application/Perspex.Themes.Default/Perspex.Themes.Default.Carousel.paml"/> |
|||
<StyleInclude Source="resource://application/Perspex.Themes.Default/Perspex.Themes.Default.CheckBox.paml"/> |
|||
<StyleInclude Source="resource://application/Perspex.Themes.Default/Perspex.Themes.Default.DropDown.paml"/> |
|||
<StyleInclude Source="resource://application/Perspex.Themes.Default/Perspex.Themes.Default.GridSplitter.paml"/> |
|||
<StyleInclude Source="resource://application/Perspex.Themes.Default/Perspex.Themes.Default.ItemsControl.paml"/> |
|||
<StyleInclude Source="resource://application/Perspex.Themes.Default/Perspex.Themes.Default.ListBox.paml"/> |
|||
<StyleInclude Source="resource://application/Perspex.Themes.Default/Perspex.Themes.Default.ListBoxItem.paml"/> |
|||
<StyleInclude Source="resource://application/Perspex.Themes.Default/Perspex.Themes.Default.Menu.paml"/> |
|||
<StyleInclude Source="resource://application/Perspex.Themes.Default/Perspex.Themes.Default.MenuItem.paml"/> |
|||
<StyleInclude Source="resource://application/Perspex.Themes.Default/Perspex.Themes.Default.PopupRoot.paml"/> |
|||
<StyleInclude Source="resource://application/Perspex.Themes.Default/Perspex.Themes.Default.RadioButton.paml"/> |
|||
<StyleInclude Source="resource://application/Perspex.Themes.Default/Perspex.Themes.Default.ScrollBar.paml"/> |
|||
<StyleInclude Source="resource://application/Perspex.Themes.Default/Perspex.Themes.Default.ScrollViewer.paml"/> |
|||
<StyleInclude Source="resource://application/Perspex.Themes.Default/Perspex.Themes.Default.TabControl.paml"/> |
|||
<StyleInclude Source="resource://application/Perspex.Themes.Default/Perspex.Themes.Default.TabItem.paml"/> |
|||
<StyleInclude Source="resource://application/Perspex.Themes.Default/Perspex.Themes.Default.TabStrip.paml"/> |
|||
<StyleInclude Source="resource://application/Perspex.Themes.Default/Perspex.Themes.Default.TextBox.paml"/> |
|||
<StyleInclude Source="resource://application/Perspex.Themes.Default/Perspex.Themes.Default.ToggleButton.paml"/> |
|||
<StyleInclude Source="resource://application/Perspex.Themes.Default/Perspex.Themes.Default.TreeView.paml"/> |
|||
<StyleInclude Source="resource://application/Perspex.Themes.Default/Perspex.Themes.Default.TreeViewItem.paml"/> |
|||
<StyleInclude Source="resource://application/Perspex.Themes.Default/Perspex.Themes.Default.Window.paml"/> |
|||
</Styles> |
|||
@ -0,0 +1,22 @@ |
|||
// Copyright (c) The Perspex Project. All rights reserved.
|
|||
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
|||
|
|||
using Perspex.Markup.Xaml; |
|||
using Perspex.Styling; |
|||
|
|||
namespace Perspex.Themes.Default |
|||
{ |
|||
/// <summary>
|
|||
/// The default Perspex theme.
|
|||
/// </summary>
|
|||
public class DefaultTheme : Styles |
|||
{ |
|||
/// <summary>
|
|||
/// Initializes a new instance of the <see cref="DefaultTheme"/> class.
|
|||
/// </summary>
|
|||
public DefaultTheme() |
|||
{ |
|||
PerspexXamlLoader.Load(this); |
|||
} |
|||
} |
|||
} |
|||
@ -1,147 +0,0 @@ |
|||
// Copyright (c) The Perspex Project. All rights reserved.
|
|||
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
|||
|
|||
using System.Linq; |
|||
using System.Reactive.Linq; |
|||
using Perspex.Collections; |
|||
using Perspex.Controls; |
|||
using Perspex.Controls.Presenters; |
|||
using Perspex.Controls.Primitives; |
|||
using Perspex.Controls.Shapes; |
|||
using Perspex.Controls.Templates; |
|||
using Perspex.Layout; |
|||
using Perspex.Media; |
|||
using Perspex.Styling; |
|||
|
|||
namespace Perspex.Themes.Default |
|||
{ |
|||
using Controls = Controls.Controls; |
|||
|
|||
/// <summary>
|
|||
/// The default style for the <see cref="DropDown"/> control.
|
|||
/// </summary>
|
|||
public class DropDownStyle : Styles |
|||
{ |
|||
/// <summary>
|
|||
/// Initializes a new instance of the <see cref="DropDownStyle"/> class.
|
|||
/// </summary>
|
|||
public DropDownStyle() |
|||
{ |
|||
AddRange(new[] |
|||
{ |
|||
new Style(x => x.OfType<DropDown>()) |
|||
{ |
|||
Setters = new[] |
|||
{ |
|||
new Setter(TemplatedControl.TemplateProperty, new FuncControlTemplate<DropDown>(Template)), |
|||
new Setter(TemplatedControl.BorderBrushProperty, new SolidColorBrush(0xff707070)), |
|||
new Setter(TemplatedControl.BorderThicknessProperty, 2.0), |
|||
new Setter(Control.FocusAdornerProperty, new FuncTemplate<IControl>(FocusAdornerTemplate)), |
|||
new Setter(DropDown.HorizontalContentAlignmentProperty, HorizontalAlignment.Center), |
|||
new Setter(DropDown.VerticalContentAlignmentProperty, VerticalAlignment.Center), |
|||
}, |
|||
}, |
|||
new Style(x => x.OfType<DropDown>().Descendent().OfType<ListBoxItem>().Class(":pointerover")) |
|||
{ |
|||
Setters = new[] |
|||
{ |
|||
new Setter(TemplatedControl.BackgroundProperty, new SolidColorBrush(0xffbee6fd)) |
|||
} |
|||
} |
|||
}); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// The default template for a <see cref="DropDown"/> control's focus adorner.
|
|||
/// </summary>
|
|||
/// <returns>The root of the instantiated template.</returns>
|
|||
public static Control FocusAdornerTemplate() |
|||
{ |
|||
return new Rectangle |
|||
{ |
|||
Stroke = Brushes.Black, |
|||
StrokeThickness = 1, |
|||
StrokeDashArray = new PerspexList<double>(1, 2), |
|||
Margin = new Thickness(3.5), |
|||
}; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// The default template for a <see cref="DropDown"/> control.
|
|||
/// </summary>
|
|||
/// <param name="control">The control being styled.</param>
|
|||
/// <returns>The root of the instantiated template.</returns>
|
|||
public static Control Template(DropDown control) |
|||
{ |
|||
Border result = new Border |
|||
{ |
|||
[~Border.BackgroundProperty] = control[~TemplatedControl.BackgroundProperty], |
|||
[~Border.BorderBrushProperty] = control[~TemplatedControl.BorderBrushProperty], |
|||
[~Border.BorderThicknessProperty] = control[~TemplatedControl.BorderThicknessProperty], |
|||
Child = new Grid |
|||
{ |
|||
Name = "container", |
|||
ColumnDefinitions = new ColumnDefinitions |
|||
{ |
|||
new ColumnDefinition(new GridLength(1, GridUnitType.Star)), |
|||
new ColumnDefinition(GridLength.Auto), |
|||
}, |
|||
Children = new Controls |
|||
{ |
|||
new ContentControl |
|||
{ |
|||
Name = "contentControl", |
|||
Margin = new Thickness(3), |
|||
[~ContentControl.ContentProperty] = control[~DropDown.SelectionBoxItemProperty], |
|||
[~Layoutable.HorizontalAlignmentProperty] = control[~DropDown.HorizontalContentAlignmentProperty], |
|||
[~Layoutable.VerticalAlignmentProperty] = control[~DropDown.VerticalContentAlignmentProperty], |
|||
}, |
|||
new ToggleButton |
|||
{ |
|||
Name = "toggle", |
|||
BorderThickness = 0, |
|||
Background = Brushes.Transparent, |
|||
ClickMode = ClickMode.Press, |
|||
Focusable = false, |
|||
Content = new Path |
|||
{ |
|||
Name = "checkMark", |
|||
Fill = Brushes.Black, |
|||
Width = 8, |
|||
Height = 4, |
|||
Stretch = Stretch.Uniform, |
|||
HorizontalAlignment = HorizontalAlignment.Center, |
|||
VerticalAlignment = VerticalAlignment.Center, |
|||
Data = StreamGeometry.Parse("F1 M 301.14,-189.041L 311.57,-189.041L 306.355,-182.942L 301.14,-189.041 Z"), |
|||
[Grid.ColumnProperty] = 0, |
|||
}, |
|||
[~~ToggleButton.IsCheckedProperty] = control[~~DropDown.IsDropDownOpenProperty], |
|||
[Grid.ColumnProperty] = 1, |
|||
}, |
|||
new Popup |
|||
{ |
|||
Name = "PART_Popup", |
|||
Child = new Border |
|||
{ |
|||
BorderBrush = Brushes.Black, |
|||
BorderThickness = 1, |
|||
Padding = new Thickness(4), |
|||
Child = new ItemsPresenter |
|||
{ |
|||
MemberSelector = control.MemberSelector, |
|||
[~ItemsPresenter.ItemsProperty] = control[~ItemsControl.ItemsProperty], |
|||
} |
|||
}, |
|||
PlacementTarget = control, |
|||
StaysOpen = false, |
|||
[~~Popup.IsOpenProperty] = control[~~DropDown.IsDropDownOpenProperty], |
|||
[~Layoutable.MinWidthProperty] = control[~Visual.BoundsProperty].Cast<Rect>().Select(x => (object)x.Width), |
|||
} |
|||
}, |
|||
}, |
|||
}; |
|||
|
|||
return result; |
|||
} |
|||
} |
|||
} |
|||
@ -1,49 +0,0 @@ |
|||
// Copyright (c) The Perspex Project. All rights reserved.
|
|||
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
|||
|
|||
using Perspex.Collections; |
|||
using Perspex.Controls; |
|||
using Perspex.Controls.Shapes; |
|||
using Perspex.Controls.Templates; |
|||
using Perspex.Media; |
|||
using Perspex.Styling; |
|||
|
|||
namespace Perspex.Themes.Default |
|||
{ |
|||
/// <summary>
|
|||
/// The default style for a focus adorner.
|
|||
/// </summary>
|
|||
public class FocusAdornerStyle : Styles |
|||
{ |
|||
/// <summary>
|
|||
/// Initializes a new instance of the <see cref="FocusAdornerStyle"/> class.
|
|||
/// </summary>
|
|||
public FocusAdornerStyle() |
|||
{ |
|||
AddRange(new[] |
|||
{ |
|||
new Style(x => x.Is<Control>()) |
|||
{ |
|||
Setters = new[] |
|||
{ |
|||
new Setter(Control.FocusAdornerProperty, new FuncTemplate<IControl>(Template)), |
|||
}, |
|||
}, |
|||
}); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// The default template for focus adorner.
|
|||
/// </summary>
|
|||
/// <returns>The root of the instantiated template.</returns>
|
|||
public static Control Template() |
|||
{ |
|||
return new Rectangle |
|||
{ |
|||
Stroke = Brushes.Black, |
|||
StrokeThickness = 1, |
|||
StrokeDashArray = new PerspexList<double>(1, 2), |
|||
}; |
|||
} |
|||
} |
|||
} |
|||
@ -1,51 +0,0 @@ |
|||
// Copyright (c) The Perspex Project. All rights reserved.
|
|||
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
|||
|
|||
using System.Linq; |
|||
using Perspex.Controls; |
|||
using Perspex.Controls.Primitives; |
|||
using Perspex.Controls.Templates; |
|||
using Perspex.Layout; |
|||
using Perspex.Styling; |
|||
|
|||
namespace Perspex.Themes.Default |
|||
{ |
|||
/// <summary>
|
|||
/// The default style for the <see cref="GridSplitter"/> control.
|
|||
/// </summary>
|
|||
public class GridSplitterStyle : Styles |
|||
{ |
|||
/// <summary>
|
|||
/// Initializes a new instance of the <see cref="GridSplitterStyle"/> class.
|
|||
/// </summary>
|
|||
public GridSplitterStyle() |
|||
{ |
|||
AddRange(new[] |
|||
{ |
|||
new Style(x => x.OfType<GridSplitter>()) |
|||
{ |
|||
Setters = new[] |
|||
{ |
|||
new Setter(TemplatedControl.TemplateProperty, new FuncControlTemplate<GridSplitter>(Template)), |
|||
new Setter(Layoutable.WidthProperty, 4.0), |
|||
}, |
|||
}, |
|||
}); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// The default template for a <see cref="GridSplitter"/> control.
|
|||
/// </summary>
|
|||
/// <param name="control">The control being styled.</param>
|
|||
/// <returns>The root of the instantiated template.</returns>
|
|||
public static Control Template(GridSplitter control) |
|||
{ |
|||
Border border = new Border |
|||
{ |
|||
[~Border.BackgroundProperty] = control[~TemplatedControl.BackgroundProperty], |
|||
}; |
|||
|
|||
return border; |
|||
} |
|||
} |
|||
} |
|||
@ -1,51 +0,0 @@ |
|||
// Copyright (c) The Perspex Project. All rights reserved.
|
|||
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
|||
|
|||
using System.Linq; |
|||
using Perspex.Controls; |
|||
using Perspex.Controls.Presenters; |
|||
using Perspex.Controls.Primitives; |
|||
using Perspex.Controls.Templates; |
|||
using Perspex.Styling; |
|||
|
|||
namespace Perspex.Themes.Default |
|||
{ |
|||
/// <summary>
|
|||
/// The default style for the <see cref="ItemsControl"/> control.
|
|||
/// </summary>
|
|||
public class ItemsControlStyle : Styles |
|||
{ |
|||
/// <summary>
|
|||
/// Initializes a new instance of the <see cref="ItemsControlStyle"/> class.
|
|||
/// </summary>
|
|||
public ItemsControlStyle() |
|||
{ |
|||
AddRange(new[] |
|||
{ |
|||
new Style(x => x.OfType<ItemsControl>()) |
|||
{ |
|||
Setters = new[] |
|||
{ |
|||
new Setter(TemplatedControl.TemplateProperty, new FuncControlTemplate<ItemsControl>(Template)), |
|||
}, |
|||
}, |
|||
}); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// The default template for an <see cref="ItemsControl"/> control.
|
|||
/// </summary>
|
|||
/// <param name="control">The control being styled.</param>
|
|||
/// <returns>The root of the instantiated template.</returns>
|
|||
public static Control Template(ItemsControl control) |
|||
{ |
|||
return new ItemsPresenter |
|||
{ |
|||
Name = "PART_ItemsPresenter", |
|||
MemberSelector = control.MemberSelector, |
|||
[~ItemsPresenter.ItemsProperty] = control[~ItemsControl.ItemsProperty], |
|||
[~ItemsPresenter.ItemsPanelProperty] = control[~ItemsControl.ItemsPanelProperty], |
|||
}; |
|||
} |
|||
} |
|||
} |
|||
@ -1,70 +0,0 @@ |
|||
// Copyright (c) The Perspex Project. All rights reserved.
|
|||
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
|||
|
|||
using System.Linq; |
|||
using Perspex.Controls; |
|||
using Perspex.Controls.Presenters; |
|||
using Perspex.Controls.Primitives; |
|||
using Perspex.Controls.Templates; |
|||
using Perspex.Media; |
|||
using Perspex.Styling; |
|||
|
|||
namespace Perspex.Themes.Default |
|||
{ |
|||
/// <summary>
|
|||
/// The default style for the <see cref="ListBoxItem"/> control.
|
|||
/// </summary>
|
|||
public class ListBoxItemStyle : Styles |
|||
{ |
|||
/// <summary>
|
|||
/// Initializes a new instance of the <see cref="ListBoxItemStyle"/> class.
|
|||
/// </summary>
|
|||
public ListBoxItemStyle() |
|||
{ |
|||
AddRange(new[] |
|||
{ |
|||
new Style(x => x.OfType<ListBoxItem>()) |
|||
{ |
|||
Setters = new[] |
|||
{ |
|||
new Setter(TemplatedControl.TemplateProperty, new FuncControlTemplate<ListBoxItem>(Template)), |
|||
}, |
|||
}, |
|||
new Style(x => x.OfType<ListBoxItem>().Class(":selected").Template().Name("border")) |
|||
{ |
|||
Setters = new[] |
|||
{ |
|||
new Setter(TemplatedControl.BackgroundProperty, new SolidColorBrush(0xfff0f0f0)), |
|||
}, |
|||
}, |
|||
new Style(x => x.OfType<ListBoxItem>().Class(":selected").Class(":focus").Template().Name("border")) |
|||
{ |
|||
Setters = new[] |
|||
{ |
|||
new Setter(TemplatedControl.BackgroundProperty, new SolidColorBrush(0xffd0d0d0)), |
|||
}, |
|||
}, |
|||
}); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// The default template for a <see cref="ListBoxItem"/> control.
|
|||
/// </summary>
|
|||
/// <param name="control">The control being styled.</param>
|
|||
/// <returns>The root of the instantiated template.</returns>
|
|||
public static Control Template(ListBoxItem control) |
|||
{ |
|||
return new Border |
|||
{ |
|||
Name = "border", |
|||
[~Border.BackgroundProperty] = control[~TemplatedControl.BackgroundProperty], |
|||
[~Border.BorderBrushProperty] = control[~TemplatedControl.BorderBrushProperty], |
|||
[~Border.BorderThicknessProperty] = control[~TemplatedControl.BorderThicknessProperty], |
|||
Child = new ContentPresenter |
|||
{ |
|||
[~ContentPresenter.ContentProperty] = control[~ContentControl.ContentProperty], |
|||
}, |
|||
}; |
|||
} |
|||
} |
|||
} |
|||
@ -1,64 +0,0 @@ |
|||
// Copyright (c) The Perspex Project. All rights reserved.
|
|||
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
|||
|
|||
using System.Linq; |
|||
using Perspex.Controls; |
|||
using Perspex.Controls.Presenters; |
|||
using Perspex.Controls.Primitives; |
|||
using Perspex.Controls.Templates; |
|||
using Perspex.Media; |
|||
using Perspex.Styling; |
|||
|
|||
namespace Perspex.Themes.Default |
|||
{ |
|||
/// <summary>
|
|||
/// The default style for the <see cref="ListBox"/> control.
|
|||
/// </summary>
|
|||
public class ListBoxStyle : Styles |
|||
{ |
|||
/// <summary>
|
|||
/// Initializes a new instance of the <see cref="ListBoxStyle"/> class.
|
|||
/// </summary>
|
|||
public ListBoxStyle() |
|||
{ |
|||
AddRange(new[] |
|||
{ |
|||
new Style(x => x.OfType<ListBox>()) |
|||
{ |
|||
Setters = new[] |
|||
{ |
|||
new Setter(TemplatedControl.TemplateProperty, new FuncControlTemplate<ListBox>(Template)), |
|||
new Setter(TemplatedControl.BorderBrushProperty, Brushes.Black), |
|||
new Setter(TemplatedControl.BorderThicknessProperty, 1.0), |
|||
}, |
|||
}, |
|||
}); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// The default template for a <see cref="ListBox"/> control.
|
|||
/// </summary>
|
|||
/// <param name="control">The control being styled.</param>
|
|||
/// <returns>The root of the instantiated template.</returns>
|
|||
public static Control Template(ListBox control) |
|||
{ |
|||
return new Border |
|||
{ |
|||
Padding = new Thickness(4), |
|||
[~Border.BackgroundProperty] = control[~TemplatedControl.BackgroundProperty], |
|||
[~Border.BorderBrushProperty] = control[~TemplatedControl.BorderBrushProperty], |
|||
[~Border.BorderThicknessProperty] = control[~TemplatedControl.BorderThicknessProperty], |
|||
Child = new ScrollViewer |
|||
{ |
|||
Content = new ItemsPresenter |
|||
{ |
|||
Name = "itemsPresenter", |
|||
MemberSelector = control.MemberSelector, |
|||
[~ItemsPresenter.ItemsProperty] = control[~ItemsControl.ItemsProperty], |
|||
[~ItemsPresenter.ItemsPanelProperty] = control[~ItemsControl.ItemsPanelProperty], |
|||
} |
|||
} |
|||
}; |
|||
} |
|||
} |
|||
} |
|||
@ -1,264 +0,0 @@ |
|||
// Copyright (c) The Perspex Project. All rights reserved.
|
|||
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
|||
|
|||
using System.Linq; |
|||
using Perspex.Controls; |
|||
using Perspex.Controls.Presenters; |
|||
using Perspex.Controls.Primitives; |
|||
using Perspex.Controls.Shapes; |
|||
using Perspex.Controls.Templates; |
|||
using Perspex.Input; |
|||
using Perspex.Layout; |
|||
using Perspex.Media; |
|||
using Perspex.Styling; |
|||
|
|||
namespace Perspex.Themes.Default |
|||
{ |
|||
using Controls = Controls.Controls; |
|||
|
|||
/// <summary>
|
|||
/// The default style for the <see cref="MenuItem"/> control.
|
|||
/// </summary>
|
|||
public class MenuItemStyle : Styles |
|||
{ |
|||
private static readonly FuncDataTemplate AccessKeyDataTemplate = |
|||
new FuncDataTemplate<string>(x => new AccessText { Text = x }); |
|||
|
|||
/// <summary>
|
|||
/// Initializes a new instance of the <see cref="MenuItemStyle"/> class.
|
|||
/// </summary>
|
|||
public MenuItemStyle() |
|||
{ |
|||
AddRange(new[] |
|||
{ |
|||
new Style(x => x.OfType<MenuItem>()) |
|||
{ |
|||
Setters = new[] |
|||
{ |
|||
new Setter(TemplatedControl.BorderThicknessProperty, 1.0), |
|||
new Setter(TemplatedControl.PaddingProperty, new Thickness(6, 0)), |
|||
new Setter(TemplatedControl.TemplateProperty, new FuncControlTemplate<MenuItem>(PopupTemplate)), |
|||
}, |
|||
}, |
|||
new Style(x => x.OfType<Menu>().Child().OfType<MenuItem>()) |
|||
{ |
|||
Setters = new[] |
|||
{ |
|||
new Setter(TemplatedControl.TemplateProperty, new FuncControlTemplate<MenuItem>(TopLevelTemplate)), |
|||
}, |
|||
}, |
|||
new Style(x => x.OfType<MenuItem>().Class(":selected").Template().Name("root")) |
|||
{ |
|||
Setters = new[] |
|||
{ |
|||
new Setter(Border.BackgroundProperty, new SolidColorBrush(0x3d26a0da)), |
|||
new Setter(Border.BorderBrushProperty, new SolidColorBrush(0xff26a0da)), |
|||
}, |
|||
}, |
|||
new Style(x => x.OfType<MenuItem>().Class(":pointerover").Template().Name("root")) |
|||
{ |
|||
Setters = new[] |
|||
{ |
|||
new Setter(Border.BackgroundProperty, new SolidColorBrush(0x3d26a0da)), |
|||
new Setter(Border.BorderBrushProperty, new SolidColorBrush(0xff26a0da)), |
|||
}, |
|||
}, |
|||
new Style(x => x.OfType<MenuItem>().Class(":empty").Template().Name("rightArrow")) |
|||
{ |
|||
Setters = new[] |
|||
{ |
|||
new Setter(Visual.IsVisibleProperty, false), |
|||
}, |
|||
}, |
|||
}); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// The default template for a top-level <see cref="MenuItem"/> control.
|
|||
/// </summary>
|
|||
/// <param name="control">The control being styled.</param>
|
|||
/// <returns>The root of the instantiated template.</returns>
|
|||
public static Control TopLevelTemplate(MenuItem control) |
|||
{ |
|||
Popup popup; |
|||
|
|||
var result = new Border |
|||
{ |
|||
Name = "root", |
|||
[~Border.BackgroundProperty] = control[~TemplatedControl.BackgroundProperty], |
|||
[~Border.BorderBrushProperty] = control[~TemplatedControl.BorderBrushProperty], |
|||
[~Border.BorderThicknessProperty] = control[~TemplatedControl.BorderThicknessProperty], |
|||
Child = new Panel |
|||
{ |
|||
Children = new Controls |
|||
{ |
|||
new ContentPresenter |
|||
{ |
|||
DataTemplates = new DataTemplates |
|||
{ |
|||
AccessKeyDataTemplate, |
|||
}, |
|||
[~ContentPresenter.ContentProperty] = control[~MenuItem.HeaderProperty], |
|||
[~Layoutable.MarginProperty] = control[~TemplatedControl.PaddingProperty], |
|||
[Grid.ColumnProperty] = 1, |
|||
}, |
|||
(popup = new Popup |
|||
{ |
|||
Name = "PART_Popup", |
|||
StaysOpen = true, |
|||
[!!Popup.IsOpenProperty] = control[!!MenuItem.IsSubMenuOpenProperty], |
|||
Child = new Border |
|||
{ |
|||
Background = new SolidColorBrush(0xfff0f0f0), |
|||
BorderBrush = new SolidColorBrush(0xff999999), |
|||
BorderThickness = 1, |
|||
Padding = new Thickness(2), |
|||
Child = new ScrollViewer |
|||
{ |
|||
Content = new Panel |
|||
{ |
|||
Children = new Controls |
|||
{ |
|||
new Rectangle |
|||
{ |
|||
Name = "iconSeparator", |
|||
Fill = new SolidColorBrush(0xffd7d7d7), |
|||
HorizontalAlignment = HorizontalAlignment.Left, |
|||
IsHitTestVisible = false, |
|||
Margin = new Thickness(29, 2, 0, 2), |
|||
Width = 1, |
|||
}, |
|||
new ItemsPresenter |
|||
{ |
|||
Name = "itemsPresenter", |
|||
[~ItemsPresenter.ItemsProperty] = control[~ItemsControl.ItemsProperty], |
|||
[~ItemsPresenter.ItemsPanelProperty] = control[~ItemsControl.ItemsPanelProperty], |
|||
[KeyboardNavigation.TabNavigationProperty] = KeyboardNavigationMode.Cycle, |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
}) |
|||
}, |
|||
} |
|||
}; |
|||
|
|||
popup.PlacementTarget = result; |
|||
|
|||
return result; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// The default template for a popup <see cref="MenuItem"/> control.
|
|||
/// </summary>
|
|||
/// <param name="control">The control being styled.</param>
|
|||
/// <returns>The root of the instantiated template.</returns>
|
|||
public static Control PopupTemplate(MenuItem control) |
|||
{ |
|||
Popup popup; |
|||
|
|||
var result = new Border |
|||
{ |
|||
Name = "root", |
|||
[~Border.BackgroundProperty] = control[~TemplatedControl.BackgroundProperty], |
|||
[~Border.BorderBrushProperty] = control[~TemplatedControl.BorderBrushProperty], |
|||
[~Border.BorderThicknessProperty] = control[~TemplatedControl.BorderThicknessProperty], |
|||
Child = new Grid |
|||
{ |
|||
ColumnDefinitions = new ColumnDefinitions |
|||
{ |
|||
new ColumnDefinition(22, GridUnitType.Pixel), |
|||
new ColumnDefinition(13, GridUnitType.Pixel), |
|||
new ColumnDefinition(1, GridUnitType.Star), |
|||
new ColumnDefinition(20, GridUnitType.Pixel), |
|||
}, |
|||
Children = new Controls |
|||
{ |
|||
new ContentPresenter |
|||
{ |
|||
Name = "icon", |
|||
[~ContentPresenter.ContentProperty] = control[~MenuItem.IconProperty], |
|||
Width = 16, |
|||
Height = 16, |
|||
Margin = new Thickness(3), |
|||
HorizontalAlignment = HorizontalAlignment.Center, |
|||
VerticalAlignment = VerticalAlignment.Center, |
|||
}, |
|||
new Path |
|||
{ |
|||
Data = StreamGeometry.Parse("F1M10,1.2L4.7,9.1 4.5,9.1 0,5.2 1.3,3.5 4.3,6.1 8.3,0 10,1.2z"), |
|||
Margin = new Thickness(3), |
|||
IsVisible = false, |
|||
VerticalAlignment = VerticalAlignment.Center, |
|||
[~Shape.FillProperty] = control[~TemplatedControl.ForegroundProperty], |
|||
}, |
|||
new ContentPresenter |
|||
{ |
|||
DataTemplates = new DataTemplates |
|||
{ |
|||
AccessKeyDataTemplate, |
|||
}, |
|||
VerticalAlignment = VerticalAlignment.Center, |
|||
[~ContentPresenter.ContentProperty] = control[~MenuItem.HeaderProperty], |
|||
[~Layoutable.MarginProperty] = control[~TemplatedControl.PaddingProperty], |
|||
[Grid.ColumnProperty] = 2, |
|||
}, |
|||
new Path |
|||
{ |
|||
Name = "rightArrow", |
|||
Data = StreamGeometry.Parse("M0,0L4,3.5 0,7z"), |
|||
Fill = new SolidColorBrush(0xff212121), |
|||
Margin = new Thickness(10, 0, 0, 0), |
|||
UseLayoutRounding = false, |
|||
VerticalAlignment = VerticalAlignment.Center, |
|||
[Grid.ColumnProperty] = 3, |
|||
}, |
|||
(popup = new Popup |
|||
{ |
|||
Name = "popup", |
|||
PlacementMode = PlacementMode.Right, |
|||
StaysOpen = true, |
|||
[!!Popup.IsOpenProperty] = control[!!MenuItem.IsSubMenuOpenProperty], |
|||
Child = new Border |
|||
{ |
|||
Background = new SolidColorBrush(0xfff0f0f0), |
|||
BorderBrush = new SolidColorBrush(0xff999999), |
|||
BorderThickness = 1, |
|||
Padding = new Thickness(2), |
|||
Child = new ScrollViewer |
|||
{ |
|||
Content = new Panel |
|||
{ |
|||
Children = new Controls |
|||
{ |
|||
new Rectangle |
|||
{ |
|||
Name = "iconSeparator", |
|||
Fill = new SolidColorBrush(0xffd7d7d7), |
|||
HorizontalAlignment = HorizontalAlignment.Left, |
|||
Margin = new Thickness(29, 2, 0, 2), |
|||
Width = 1, |
|||
}, |
|||
new ItemsPresenter |
|||
{ |
|||
Name = "itemsPresenter", |
|||
[~ItemsPresenter.ItemsProperty] = control[~ItemsControl.ItemsProperty], |
|||
[~ItemsPresenter.ItemsPanelProperty] = control[~ItemsControl.ItemsPanelProperty], |
|||
[KeyboardNavigation.TabNavigationProperty] = KeyboardNavigationMode.Cycle, |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
}) |
|||
}, |
|||
} |
|||
}; |
|||
|
|||
popup.PlacementTarget = result; |
|||
|
|||
return result; |
|||
} |
|||
} |
|||
} |
|||
@ -1,59 +0,0 @@ |
|||
// Copyright (c) The Perspex Project. All rights reserved.
|
|||
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
|||
|
|||
using System.Linq; |
|||
using Perspex.Controls; |
|||
using Perspex.Controls.Presenters; |
|||
using Perspex.Controls.Primitives; |
|||
using Perspex.Controls.Templates; |
|||
using Perspex.Input; |
|||
using Perspex.Styling; |
|||
|
|||
namespace Perspex.Themes.Default |
|||
{ |
|||
/// <summary>
|
|||
/// The default style for the <see cref="Menu"/> control.
|
|||
/// </summary>
|
|||
public class MenuStyle : Styles |
|||
{ |
|||
/// <summary>
|
|||
/// Initializes a new instance of the <see cref="MenuStyle"/> class.
|
|||
/// </summary>
|
|||
public MenuStyle() |
|||
{ |
|||
AddRange(new[] |
|||
{ |
|||
new Style(x => x.OfType<Menu>()) |
|||
{ |
|||
Setters = new[] |
|||
{ |
|||
new Setter(TemplatedControl.TemplateProperty, new FuncControlTemplate<Menu>(Template)), |
|||
}, |
|||
}, |
|||
}); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// The default template for the <see cref="Menu"/> control.
|
|||
/// </summary>
|
|||
/// <param name="control">The control being styled.</param>
|
|||
/// <returns>The root of the instantiated template.</returns>
|
|||
public static Control Template(Menu control) |
|||
{ |
|||
return new Border |
|||
{ |
|||
[~Border.BackgroundProperty] = control[~TemplatedControl.BackgroundProperty], |
|||
[~Border.BorderBrushProperty] = control[~TemplatedControl.BorderBrushProperty], |
|||
[~Border.BorderThicknessProperty] = control[~TemplatedControl.BorderThicknessProperty], |
|||
[~Decorator.PaddingProperty] = control[~TemplatedControl.PaddingProperty], |
|||
Child = new ItemsPresenter |
|||
{ |
|||
Name = "itemsPresenter", |
|||
[~ItemsPresenter.ItemsProperty] = control[~ItemsControl.ItemsProperty], |
|||
[~ItemsPresenter.ItemsPanelProperty] = control[~ItemsControl.ItemsPanelProperty], |
|||
[KeyboardNavigation.TabNavigationProperty] = KeyboardNavigationMode.Continue, |
|||
} |
|||
}; |
|||
} |
|||
} |
|||
} |
|||
@ -1,55 +0,0 @@ |
|||
// Copyright (c) The Perspex Project. All rights reserved.
|
|||
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
|||
|
|||
using System.Linq; |
|||
using Perspex.Controls; |
|||
using Perspex.Controls.Presenters; |
|||
using Perspex.Controls.Primitives; |
|||
using Perspex.Controls.Templates; |
|||
using Perspex.Styling; |
|||
|
|||
namespace Perspex.Themes.Default |
|||
{ |
|||
/// <summary>
|
|||
/// The default style for the <see cref="PopupRoot"/> control.
|
|||
/// </summary>
|
|||
public class PopupRootStyle : Styles |
|||
{ |
|||
/// <summary>
|
|||
/// Initializes a new instance of the <see cref="PopupRootStyle"/> class.
|
|||
/// </summary>
|
|||
public PopupRootStyle() |
|||
{ |
|||
AddRange(new[] |
|||
{ |
|||
new Style(x => x.OfType<PopupRoot>()) |
|||
{ |
|||
Setters = new[] |
|||
{ |
|||
new Setter(TemplatedControl.TemplateProperty, new FuncControlTemplate<PopupRoot>(Template)), |
|||
new Setter(TemplatedControl.FontFamilyProperty, "Segoe UI"), |
|||
new Setter(TemplatedControl.FontSizeProperty, 12.0), |
|||
}, |
|||
}, |
|||
}); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// The default template for the <see cref="PopupRoot"/> control.
|
|||
/// </summary>
|
|||
/// <param name="control">The control being styled.</param>
|
|||
/// <returns>The root of the instantiated template.</returns>
|
|||
public static Control Template(PopupRoot control) |
|||
{ |
|||
return new Border |
|||
{ |
|||
[~Border.BackgroundProperty] = control[~TemplatedControl.BackgroundProperty], |
|||
Child = new ContentPresenter |
|||
{ |
|||
Name = "contentPresenter", |
|||
[~ContentPresenter.ContentProperty] = control[~ContentControl.ContentProperty], |
|||
} |
|||
}; |
|||
} |
|||
} |
|||
} |
|||
@ -1,89 +0,0 @@ |
|||
// Copyright (c) The Perspex Project. All rights reserved.
|
|||
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
|||
|
|||
using System.Linq; |
|||
using System.Reactive.Linq; |
|||
using Perspex.Controls; |
|||
using Perspex.Controls.Presenters; |
|||
using Perspex.Controls.Primitives; |
|||
using Perspex.Controls.Shapes; |
|||
using Perspex.Controls.Templates; |
|||
using Perspex.Layout; |
|||
using Perspex.Media; |
|||
using Perspex.Styling; |
|||
|
|||
namespace Perspex.Themes.Default |
|||
{ |
|||
using Controls = Controls.Controls; |
|||
|
|||
/// <summary>
|
|||
/// The default style for the <see cref="ProgressBar"/> control.
|
|||
/// </summary>
|
|||
public class ProgressBarStyle : Styles |
|||
{ |
|||
/// <summary>
|
|||
/// Initializes a new instance of the <see cref="ProgressBarStyle"/> class.
|
|||
/// </summary>
|
|||
public ProgressBarStyle() |
|||
{ |
|||
AddRange(new[] |
|||
{ |
|||
new Style(x => x.OfType<ProgressBar>()) |
|||
{ |
|||
Setters = new[] |
|||
{ |
|||
new Setter(TemplatedControl.TemplateProperty, new FuncControlTemplate<ProgressBar>(Template)), |
|||
new Setter(TemplatedControl.BackgroundProperty, new SolidColorBrush(0xffdddddd)), |
|||
new Setter(TemplatedControl.ForegroundProperty, new SolidColorBrush(0xffbee6fd)), |
|||
}, |
|||
} |
|||
}); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// The default template for the <see cref="ProgressBar"/> control.
|
|||
/// </summary>
|
|||
/// <param name="control">The control being styled.</param>
|
|||
/// <returns>The root of the instantiated template.</returns>
|
|||
public static Control Template(ProgressBar control) |
|||
{ |
|||
Border container = new Border |
|||
{ |
|||
[~Border.BackgroundProperty] = control[~TemplatedControl.BackgroundProperty], |
|||
[~Border.BorderBrushProperty] = control[~TemplatedControl.BorderBrushProperty], |
|||
[~Border.BorderThicknessProperty] = control[~TemplatedControl.BorderThicknessProperty], |
|||
|
|||
Child = new Grid |
|||
{ |
|||
MinHeight = 14, |
|||
MinWidth = 200, |
|||
|
|||
Children = new Controls |
|||
{ |
|||
new Border |
|||
{ |
|||
Name = "PART_Track", |
|||
BorderThickness = 1, |
|||
[~Border.BorderBrushProperty] = control[~TemplatedControl.BackgroundProperty], |
|||
}, |
|||
|
|||
new Border |
|||
{ |
|||
Name = "PART_Indicator", |
|||
BorderThickness = 1, |
|||
HorizontalAlignment = HorizontalAlignment.Left, |
|||
[~Border.BackgroundProperty] = control[~TemplatedControl.ForegroundProperty], |
|||
Child = new Grid |
|||
{ |
|||
Name = "Animation", |
|||
ClipToBounds = true, |
|||
} |
|||
} |
|||
} |
|||
} |
|||
}; |
|||
|
|||
return container; |
|||
} |
|||
} |
|||
} |
|||
@ -1,109 +0,0 @@ |
|||
// Copyright (c) The Perspex Project. All rights reserved.
|
|||
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
|||
|
|||
using System.Linq; |
|||
using Perspex.Controls; |
|||
using Perspex.Controls.Presenters; |
|||
using Perspex.Controls.Primitives; |
|||
using Perspex.Controls.Shapes; |
|||
using Perspex.Controls.Templates; |
|||
using Perspex.Layout; |
|||
using Perspex.Media; |
|||
using Perspex.Styling; |
|||
|
|||
namespace Perspex.Themes.Default |
|||
{ |
|||
using Controls = Controls.Controls; |
|||
|
|||
/// <summary>
|
|||
/// The default style for the <see cref="RadioButton"/> control.
|
|||
/// </summary>
|
|||
public class RadioButtonStyle : Styles |
|||
{ |
|||
/// <summary>
|
|||
/// Initializes a new instance of the <see cref="RadioButtonStyle"/> class.
|
|||
/// </summary>
|
|||
public RadioButtonStyle() |
|||
{ |
|||
AddRange(new[] |
|||
{ |
|||
new Style(x => x.OfType<RadioButton>()) |
|||
{ |
|||
Setters = new[] |
|||
{ |
|||
new Setter(TemplatedControl.TemplateProperty, new FuncControlTemplate<RadioButton>(Template)), |
|||
}, |
|||
}, |
|||
new Style(x => x.OfType<RadioButton>().Template().Name("checkMark")) |
|||
{ |
|||
Setters = new[] |
|||
{ |
|||
new Setter(Visual.IsVisibleProperty, false), |
|||
}, |
|||
}, |
|||
new Style(x => x.OfType<RadioButton>().Class(":checked").Template().Name("checkMark")) |
|||
{ |
|||
Setters = new[] |
|||
{ |
|||
new Setter(Visual.IsVisibleProperty, true), |
|||
}, |
|||
}, |
|||
}); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// The default template for the <see cref="RadioButton"/> control.
|
|||
/// </summary>
|
|||
/// <param name="control">The control being styled.</param>
|
|||
/// <returns>The root of the instantiated template.</returns>
|
|||
public static Control Template(RadioButton control) |
|||
{ |
|||
Border result = new Border |
|||
{ |
|||
[~Border.BackgroundProperty] = control[~TemplatedControl.BackgroundProperty], |
|||
Child = new Grid |
|||
{ |
|||
ColumnDefinitions = new ColumnDefinitions |
|||
{ |
|||
new ColumnDefinition(GridLength.Auto), |
|||
new ColumnDefinition(new GridLength(1, GridUnitType.Star)), |
|||
}, |
|||
Children = new Controls |
|||
{ |
|||
new Ellipse |
|||
{ |
|||
Name = "checkBorder", |
|||
Stroke = Brushes.Black, |
|||
StrokeThickness = 2, |
|||
Width = 18, |
|||
Height = 18, |
|||
VerticalAlignment = VerticalAlignment.Center, |
|||
[Grid.ColumnProperty] = 0, |
|||
}, |
|||
new Ellipse |
|||
{ |
|||
Name = "checkMark", |
|||
Fill = Brushes.Black, |
|||
Width = 10, |
|||
Height = 10, |
|||
Stretch = Stretch.Uniform, |
|||
HorizontalAlignment = HorizontalAlignment.Center, |
|||
VerticalAlignment = VerticalAlignment.Center, |
|||
[Grid.ColumnProperty] = 0, |
|||
}, |
|||
new ContentPresenter |
|||
{ |
|||
Name = "contentPresenter", |
|||
Margin = new Thickness(4, 0, 0, 0), |
|||
VerticalAlignment = VerticalAlignment.Center, |
|||
[~ContentPresenter.ContentProperty] = control[~ContentControl.ContentProperty], |
|||
[Grid.ColumnProperty] = 1, |
|||
}, |
|||
}, |
|||
}, |
|||
}; |
|||
|
|||
return result; |
|||
} |
|||
} |
|||
} |
|||
@ -1,105 +0,0 @@ |
|||
// Copyright (c) The Perspex Project. All rights reserved.
|
|||
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
|||
|
|||
using System.Linq; |
|||
using Perspex.Controls; |
|||
using Perspex.Controls.Presenters; |
|||
using Perspex.Controls.Primitives; |
|||
using Perspex.Controls.Templates; |
|||
using Perspex.Layout; |
|||
using Perspex.Media; |
|||
using Perspex.Styling; |
|||
|
|||
namespace Perspex.Themes.Default |
|||
{ |
|||
/// <summary>
|
|||
/// The default style for the <see cref="ScrollBar"/> control.
|
|||
/// </summary>
|
|||
public class ScrollBarStyle : Styles |
|||
{ |
|||
/// <summary>
|
|||
/// Initializes a new instance of the <see cref="ScrollBarStyle"/> class.
|
|||
/// </summary>
|
|||
public ScrollBarStyle() |
|||
{ |
|||
AddRange(new[] |
|||
{ |
|||
new Style(x => x.OfType<ScrollBar>()) |
|||
{ |
|||
Setters = new[] |
|||
{ |
|||
new Setter(TemplatedControl.TemplateProperty, new FuncControlTemplate<ScrollBar>(Template)), |
|||
}, |
|||
}, |
|||
new Style(x => x.OfType<ScrollBar>().PropertyEquals(ScrollBar.OrientationProperty, Orientation.Horizontal)) |
|||
{ |
|||
Setters = new[] |
|||
{ |
|||
new Setter(Layoutable.HeightProperty, 10.0), |
|||
}, |
|||
}, |
|||
new Style(x => x.OfType<ScrollBar>().PropertyEquals(ScrollBar.OrientationProperty, Orientation.Horizontal).Template().Name("thumb")) |
|||
{ |
|||
Setters = new[] |
|||
{ |
|||
new Setter(Layoutable.MinWidthProperty, 10.0), |
|||
}, |
|||
}, |
|||
new Style(x => x.OfType<ScrollBar>().PropertyEquals(ScrollBar.OrientationProperty, Orientation.Vertical)) |
|||
{ |
|||
Setters = new[] |
|||
{ |
|||
new Setter(Layoutable.WidthProperty, 10.0), |
|||
}, |
|||
}, |
|||
new Style(x => x.OfType<ScrollBar>().PropertyEquals(ScrollBar.OrientationProperty, Orientation.Vertical).Template().Name("thumb")) |
|||
{ |
|||
Setters = new[] |
|||
{ |
|||
new Setter(Layoutable.MinHeightProperty, 10.0), |
|||
}, |
|||
}, |
|||
}); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// The default template for the <see cref="ScrollBar"/> control.
|
|||
/// </summary>
|
|||
/// <param name="control">The control being styled.</param>
|
|||
/// <returns>The root of the instantiated template.</returns>
|
|||
public static Control Template(ScrollBar control) |
|||
{ |
|||
return new Border |
|||
{ |
|||
Background = Brushes.Silver, |
|||
Child = new Track |
|||
{ |
|||
Name = "track", |
|||
[!Track.MinimumProperty] = control[!RangeBase.MinimumProperty], |
|||
[!Track.MaximumProperty] = control[!RangeBase.MaximumProperty], |
|||
[!!Track.ValueProperty] = control[!!RangeBase.ValueProperty], |
|||
[!Track.ViewportSizeProperty] = control[!ScrollBar.ViewportSizeProperty], |
|||
[!Track.OrientationProperty] = control[!ScrollBar.OrientationProperty], |
|||
Thumb = new Thumb |
|||
{ |
|||
Name = "thumb", |
|||
Template = new FuncControlTemplate<Thumb>(ThumbTemplate), |
|||
}, |
|||
}, |
|||
}; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// The default template for the <see cref="ScrollBar"/>'s <see cref="Thumb"/> control.
|
|||
/// </summary>
|
|||
/// <param name="control">The control being styled.</param>
|
|||
/// <returns>The root of the instantiated template.</returns>
|
|||
public static Control ThumbTemplate(Thumb control) |
|||
{ |
|||
return new Border |
|||
{ |
|||
Background = Brushes.Gray, |
|||
}; |
|||
} |
|||
} |
|||
} |
|||
@ -1,93 +0,0 @@ |
|||
// Copyright (c) The Perspex Project. All rights reserved.
|
|||
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
|||
|
|||
using System.Linq; |
|||
using Perspex.Controls; |
|||
using Perspex.Controls.Presenters; |
|||
using Perspex.Controls.Primitives; |
|||
using Perspex.Controls.Templates; |
|||
using Perspex.Styling; |
|||
|
|||
namespace Perspex.Themes.Default |
|||
{ |
|||
using Controls = Controls.Controls; |
|||
|
|||
/// <summary>
|
|||
/// The default style for the <see cref="ScrollViewer"/> control.
|
|||
/// </summary>
|
|||
public class ScrollViewerStyle : Styles |
|||
{ |
|||
/// <summary>
|
|||
/// Initializes a new instance of the <see cref="ScrollViewerStyle"/> class.
|
|||
/// </summary>
|
|||
public ScrollViewerStyle() |
|||
{ |
|||
AddRange(new[] |
|||
{ |
|||
new Style(x => x.OfType<ScrollViewer>()) |
|||
{ |
|||
Setters = new[] |
|||
{ |
|||
new Setter(TemplatedControl.TemplateProperty, new FuncControlTemplate<ScrollViewer>(Template)), |
|||
}, |
|||
}, |
|||
}); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// The default template for the <see cref="ScrollViewer"/> control.
|
|||
/// </summary>
|
|||
/// <param name="control">The control being styled.</param>
|
|||
/// <returns>The root of the instantiated template.</returns>
|
|||
public static Control Template(ScrollViewer control) |
|||
{ |
|||
var result = new Grid |
|||
{ |
|||
ColumnDefinitions = new ColumnDefinitions |
|||
{ |
|||
new ColumnDefinition(1, GridUnitType.Star), |
|||
new ColumnDefinition(GridLength.Auto), |
|||
}, |
|||
RowDefinitions = new RowDefinitions |
|||
{ |
|||
new RowDefinition(1, GridUnitType.Star), |
|||
new RowDefinition(GridLength.Auto), |
|||
}, |
|||
Children = new Controls |
|||
{ |
|||
new ScrollContentPresenter |
|||
{ |
|||
Name = "contentPresenter", |
|||
[~ContentPresenter.ContentProperty] = control[~ContentControl.ContentProperty], |
|||
[~~ScrollContentPresenter.ExtentProperty] = control[~~ScrollViewer.ExtentProperty], |
|||
[~~ScrollContentPresenter.OffsetProperty] = control[~~ScrollViewer.OffsetProperty], |
|||
[~~ScrollContentPresenter.ViewportProperty] = control[~~ScrollViewer.ViewportProperty], |
|||
[~ScrollContentPresenter.CanScrollHorizontallyProperty] = control[~ScrollViewer.CanScrollHorizontallyProperty], |
|||
}, |
|||
new ScrollBar |
|||
{ |
|||
Name = "horizontalScrollBar", |
|||
Orientation = Orientation.Horizontal, |
|||
[~RangeBase.MaximumProperty] = control[~ScrollViewer.HorizontalScrollBarMaximumProperty], |
|||
[~~RangeBase.ValueProperty] = control[~~ScrollViewer.HorizontalScrollBarValueProperty], |
|||
[~ScrollBar.ViewportSizeProperty] = control[~ScrollViewer.HorizontalScrollBarViewportSizeProperty], |
|||
[~ScrollBar.VisibilityProperty] = control[~ScrollViewer.HorizontalScrollBarVisibilityProperty], |
|||
[Grid.RowProperty] = 1, |
|||
}, |
|||
new ScrollBar |
|||
{ |
|||
Name = "verticalScrollBar", |
|||
Orientation = Orientation.Vertical, |
|||
[~RangeBase.MaximumProperty] = control[~ScrollViewer.VerticalScrollBarMaximumProperty], |
|||
[~~RangeBase.ValueProperty] = control[~~ScrollViewer.VerticalScrollBarValueProperty], |
|||
[~ScrollBar.ViewportSizeProperty] = control[~ScrollViewer.VerticalScrollBarViewportSizeProperty], |
|||
[~ScrollBar.VisibilityProperty] = control[~ScrollViewer.VerticalScrollBarVisibilityProperty], |
|||
[Grid.ColumnProperty] = 1, |
|||
}, |
|||
}, |
|||
}; |
|||
|
|||
return result; |
|||
} |
|||
} |
|||
} |
|||
@ -1,72 +0,0 @@ |
|||
// Copyright (c) The Perspex Project. All rights reserved.
|
|||
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
|||
|
|||
using System.Linq; |
|||
using System.Reactive.Linq; |
|||
using Perspex.Controls; |
|||
using Perspex.Controls.Primitives; |
|||
using Perspex.Controls.Templates; |
|||
using Perspex.Styling; |
|||
|
|||
namespace Perspex.Themes.Default |
|||
{ |
|||
using Controls = Controls.Controls; |
|||
|
|||
/// <summary>
|
|||
/// The default style for the <see cref="TabControl"/> control.
|
|||
/// </summary>
|
|||
public class TabControlStyle : Styles |
|||
{ |
|||
/// <summary>
|
|||
/// Initializes a new instance of the <see cref="TabControlStyle"/> class.
|
|||
/// </summary>
|
|||
public TabControlStyle() |
|||
{ |
|||
AddRange(new[] |
|||
{ |
|||
new Style(x => x.OfType<TabControl>()) |
|||
{ |
|||
Setters = new[] |
|||
{ |
|||
new Setter(TemplatedControl.TemplateProperty, new FuncControlTemplate<TabControl>(Template)), |
|||
}, |
|||
}, |
|||
}); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// The default template for the <see cref="TabControl"/> control.
|
|||
/// </summary>
|
|||
/// <param name="control">The control being styled.</param>
|
|||
/// <returns>The root of the instantiated template.</returns>
|
|||
public static Control Template(TabControl control) |
|||
{ |
|||
return new Grid |
|||
{ |
|||
RowDefinitions = new RowDefinitions |
|||
{ |
|||
new RowDefinition(GridLength.Auto), |
|||
new RowDefinition(new GridLength(1, GridUnitType.Star)), |
|||
}, |
|||
Children = new Controls |
|||
{ |
|||
new TabStrip |
|||
{ |
|||
Name = "tabStrip", |
|||
[!ItemsControl.ItemsProperty] = control[!ItemsControl.ItemsProperty], |
|||
[!!SelectingItemsControl.SelectedItemProperty] = control[!!SelectingItemsControl.SelectedItemProperty], |
|||
}, |
|||
new Carousel |
|||
{ |
|||
Name = "carousel", |
|||
MemberSelector = new FuncMemberSelector<TabItem, object>(x => x.Content), |
|||
[!Carousel.ItemsProperty] = control[!ItemsControl.ItemsProperty], |
|||
[!Carousel.SelectedItemProperty] = control[!SelectingItemsControl.SelectedItemProperty], |
|||
[~Carousel.TransitionProperty] = control[~TabControl.TransitionProperty], |
|||
[Grid.RowProperty] = 1, |
|||
} |
|||
} |
|||
}; |
|||
} |
|||
} |
|||
} |
|||
@ -1,59 +0,0 @@ |
|||
// Copyright (c) The Perspex Project. All rights reserved.
|
|||
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
|||
|
|||
using System.Linq; |
|||
using Perspex.Controls; |
|||
using Perspex.Controls.Presenters; |
|||
using Perspex.Controls.Primitives; |
|||
using Perspex.Controls.Templates; |
|||
using Perspex.Media; |
|||
using Perspex.Styling; |
|||
|
|||
namespace Perspex.Themes.Default |
|||
{ |
|||
/// <summary>
|
|||
/// The default style for the <see cref="TabItem"/> control.
|
|||
/// </summary>
|
|||
public class TabItemStyle : Styles |
|||
{ |
|||
/// <summary>
|
|||
/// Initializes a new instance of the <see cref="TabItemStyle"/> class.
|
|||
/// </summary>
|
|||
public TabItemStyle() |
|||
{ |
|||
AddRange(new[] |
|||
{ |
|||
new Style(x => x.OfType<TabItem>()) |
|||
{ |
|||
Setters = new[] |
|||
{ |
|||
new Setter(TemplatedControl.FontSizeProperty, 16.0), |
|||
new Setter(TemplatedControl.ForegroundProperty, Brushes.Gray), |
|||
new Setter(TemplatedControl.TemplateProperty, new FuncControlTemplate<TabItem>(Template)), |
|||
}, |
|||
}, |
|||
new Style(x => x.OfType<TabItem>().Class(":selected")) |
|||
{ |
|||
Setters = new[] |
|||
{ |
|||
new Setter(TemplatedControl.ForegroundProperty, Brushes.Black), |
|||
}, |
|||
}, |
|||
}); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// The default template for the <see cref="TabItem"/> control.
|
|||
/// </summary>
|
|||
/// <param name="control">The control being styled.</param>
|
|||
/// <returns>The root of the instantiated template.</returns>
|
|||
public static Control Template(TabItem control) |
|||
{ |
|||
return new ContentPresenter |
|||
{ |
|||
Name = "headerPresenter", |
|||
[~ContentPresenter.ContentProperty] = control[~HeaderedContentControl.HeaderProperty], |
|||
}; |
|||
} |
|||
} |
|||
} |
|||
@ -1,58 +0,0 @@ |
|||
// Copyright (c) The Perspex Project. All rights reserved.
|
|||
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
|||
|
|||
using System.Linq; |
|||
using Perspex.Controls; |
|||
using Perspex.Controls.Presenters; |
|||
using Perspex.Controls.Primitives; |
|||
using Perspex.Controls.Templates; |
|||
using Perspex.Styling; |
|||
|
|||
namespace Perspex.Themes.Default |
|||
{ |
|||
/// <summary>
|
|||
/// The default style for the <see cref="TabStrip"/> control.
|
|||
/// </summary>
|
|||
public class TabStripStyle : Styles |
|||
{ |
|||
/// <summary>
|
|||
/// Initializes a new instance of the <see cref="TabStripStyle"/> class.
|
|||
/// </summary>
|
|||
public TabStripStyle() |
|||
{ |
|||
AddRange(new[] |
|||
{ |
|||
new Style(x => x.OfType<TabStrip>()) |
|||
{ |
|||
Setters = new[] |
|||
{ |
|||
new Setter(TemplatedControl.TemplateProperty, new FuncControlTemplate<TabStrip>(Template)), |
|||
}, |
|||
}, |
|||
new Style(x => x.OfType<TabStrip>().Template().OfType<StackPanel>()) |
|||
{ |
|||
Setters = new[] |
|||
{ |
|||
new Setter(StackPanel.GapProperty, 16.0), |
|||
new Setter(StackPanel.OrientationProperty, Orientation.Horizontal), |
|||
}, |
|||
}, |
|||
}); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// The default template for the <see cref="TabStrip"/> control.
|
|||
/// </summary>
|
|||
/// <param name="control">The control being styled.</param>
|
|||
/// <returns>The root of the instantiated template.</returns>
|
|||
public static Control Template(TabStrip control) |
|||
{ |
|||
return new ItemsPresenter |
|||
{ |
|||
Name = "itemsPresenter", |
|||
[~ItemsPresenter.ItemsProperty] = control[~ItemsControl.ItemsProperty], |
|||
[~ItemsPresenter.ItemsPanelProperty] = control[~ItemsControl.ItemsPanelProperty], |
|||
}; |
|||
} |
|||
} |
|||
} |
|||
@ -1,6 +1,4 @@ |
|||
<Styles xmlns="https://github.com/perspex" |
|||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
|||
xmlns:local="clr-namespace:XamlTestApplication;assembly=XamlTestApplicationPcl"> |
|||
<Styles xmlns="https://github.com/perspex"> |
|||
<Style Selector="TextBox"> |
|||
<Setter Property="Background" Value="White"/> |
|||
<Setter Property="BorderBrush" Value="#ff707070"/> |
|||
@ -1,110 +0,0 @@ |
|||
// Copyright (c) The Perspex Project. All rights reserved.
|
|||
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
|||
|
|||
using System.Linq; |
|||
using Perspex.Controls; |
|||
using Perspex.Controls.Presenters; |
|||
using Perspex.Controls.Primitives; |
|||
using Perspex.Controls.Templates; |
|||
using Perspex.Media; |
|||
using Perspex.Styling; |
|||
using System.Reactive.Linq; |
|||
|
|||
namespace Perspex.Themes.Default |
|||
{ |
|||
/// <summary>
|
|||
/// The default style for the <see cref="TextBox"/> control.
|
|||
/// </summary>
|
|||
public class TextBoxStyle : Styles |
|||
{ |
|||
/// <summary>
|
|||
/// Initializes a new instance of the <see cref="TextBoxStyle"/> class.
|
|||
/// </summary>
|
|||
public TextBoxStyle() |
|||
{ |
|||
AddRange(new[] |
|||
{ |
|||
new Style(x => x.OfType<TextBox>()) |
|||
{ |
|||
Setters = new[] |
|||
{ |
|||
new Setter(TemplatedControl.TemplateProperty, new FuncControlTemplate<TextBox>(Template)), |
|||
new Setter(TemplatedControl.BackgroundProperty, Brushes.White), |
|||
new Setter(TemplatedControl.BorderBrushProperty, new SolidColorBrush(0xff707070)), |
|||
new Setter(TemplatedControl.BorderThicknessProperty, 2.0), |
|||
new Setter(Control.FocusAdornerProperty, null), |
|||
}, |
|||
}, |
|||
new Style(x => x.OfType<TextBox>().Class(":focus").Template().Name("border")) |
|||
{ |
|||
Setters = new[] |
|||
{ |
|||
new Setter(TemplatedControl.BorderBrushProperty, Brushes.Black), |
|||
}, |
|||
} |
|||
}); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// The default template for the <see cref="TextBox"/> control.
|
|||
/// </summary>
|
|||
/// <param name="control">The control being styled.</param>
|
|||
/// <returns>The root of the instantiated template.</returns>
|
|||
public static Control Template(TextBox control) |
|||
{ |
|||
Border result = new Border |
|||
{ |
|||
Name = "border", |
|||
Padding = new Thickness(2), |
|||
[~Border.BackgroundProperty] = control[~TemplatedControl.BackgroundProperty], |
|||
[~Border.BorderBrushProperty] = control[~TemplatedControl.BorderBrushProperty], |
|||
[~Border.BorderThicknessProperty] = control[~TemplatedControl.BorderThicknessProperty], |
|||
|
|||
Child = new ScrollViewer |
|||
{ |
|||
[~ScrollViewer.CanScrollHorizontallyProperty] = control[~ScrollViewer.CanScrollHorizontallyProperty], |
|||
[~ScrollViewer.HorizontalScrollBarVisibilityProperty] = control[~ScrollViewer.HorizontalScrollBarVisibilityProperty], |
|||
[~ScrollViewer.VerticalScrollBarVisibilityProperty] = control[~ScrollViewer.VerticalScrollBarVisibilityProperty], |
|||
Content = new StackPanel |
|||
{ |
|||
Children = new Controls.Controls |
|||
{ |
|||
new TextBlock |
|||
{ |
|||
Name = "floatingWatermark", |
|||
Foreground = SolidColorBrush.Parse("#007ACC"), |
|||
FontSize = 10, |
|||
[~TextBlock.TextProperty] = control[~TextBox.WatermarkProperty], |
|||
[~TextBlock.IsVisibleProperty] = control[~TextBox.TextProperty].Cast<string>().Select(x => (object)(!string.IsNullOrEmpty(x) && control.UseFloatingWatermark)) |
|||
}, |
|||
new Panel |
|||
{ |
|||
Children = new Controls.Controls |
|||
{ |
|||
new TextBlock |
|||
{ |
|||
Name = "watermark", |
|||
Opacity = 0.5, |
|||
[~TextBlock.TextProperty] = control[~TextBox.WatermarkProperty], |
|||
[~TextBlock.IsVisibleProperty] = control[~TextBox.TextProperty].Cast<string>().Select(x => (object)string.IsNullOrEmpty(x)) |
|||
}, |
|||
new TextPresenter |
|||
{ |
|||
Name = "PART_TextPresenter", |
|||
[~TextPresenter.CaretIndexProperty] = control[~TextBox.CaretIndexProperty], |
|||
[~TextPresenter.SelectionStartProperty] = control[~TextBox.SelectionStartProperty], |
|||
[~TextPresenter.SelectionEndProperty] = control[~TextBox.SelectionEndProperty], |
|||
[~TextBlock.TextProperty] = control[~TextBox.TextProperty], |
|||
[~TextBlock.TextWrappingProperty] = control[~TextBox.TextWrappingProperty], |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
}; |
|||
|
|||
return result; |
|||
} |
|||
} |
|||
} |
|||
@ -1,114 +0,0 @@ |
|||
// Copyright (c) The Perspex Project. All rights reserved.
|
|||
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
|||
|
|||
using System.Linq; |
|||
using Perspex.Controls; |
|||
using Perspex.Controls.Presenters; |
|||
using Perspex.Controls.Primitives; |
|||
using Perspex.Controls.Templates; |
|||
using Perspex.Layout; |
|||
using Perspex.Media; |
|||
using Perspex.Styling; |
|||
|
|||
namespace Perspex.Themes.Default |
|||
{ |
|||
/// <summary>
|
|||
/// The default style for the <see cref="ToggleButton"/> control.
|
|||
/// </summary>
|
|||
public class ToggleButtonStyle : Styles |
|||
{ |
|||
/// <summary>
|
|||
/// Initializes a new instance of the <see cref="ToggleButtonStyle"/> class.
|
|||
/// </summary>
|
|||
public ToggleButtonStyle() |
|||
{ |
|||
AddRange(new[] |
|||
{ |
|||
new Style(x => x.OfType<ToggleButton>()) |
|||
{ |
|||
Setters = new[] |
|||
{ |
|||
new Setter(TemplatedControl.TemplateProperty, new FuncControlTemplate<ToggleButton>(Template)), |
|||
new Setter(TemplatedControl.BackgroundProperty, new SolidColorBrush(0xffaaaaaa)), |
|||
new Setter(TemplatedControl.BorderBrushProperty, new SolidColorBrush(0xffaaaaaa)), |
|||
new Setter(TemplatedControl.BorderThicknessProperty, 2.0), |
|||
new Setter(Control.FocusAdornerProperty, new FuncTemplate<IControl>(ButtonStyle.FocusAdornerTemplate)), |
|||
new Setter(TemplatedControl.ForegroundProperty, new SolidColorBrush(0xff000000)), |
|||
new Setter(ContentControl.HorizontalContentAlignmentProperty, HorizontalAlignment.Center), |
|||
new Setter(ContentControl.VerticalContentAlignmentProperty, VerticalAlignment.Center), |
|||
}, |
|||
}, |
|||
new Style(x => x.OfType<ToggleButton>().Class(":checked").Template().Name("border")) |
|||
{ |
|||
Setters = new[] |
|||
{ |
|||
new Setter(TemplatedControl.BackgroundProperty, new SolidColorBrush(0xff777777)), |
|||
new Setter(TemplatedControl.BorderBrushProperty, new SolidColorBrush(0xff77777)), |
|||
}, |
|||
}, |
|||
new Style(x => x.OfType<ToggleButton>().Class(":pointerover").Template().Name("border")) |
|||
{ |
|||
Setters = new[] |
|||
{ |
|||
new Setter(TemplatedControl.BackgroundProperty, new SolidColorBrush(0xff888888)), |
|||
new Setter(TemplatedControl.BorderBrushProperty, new SolidColorBrush(0xff888888)), |
|||
}, |
|||
}, |
|||
new Style(x => x.OfType<ToggleButton>().Class(":checked").Class(":pointerover").Template().Name("border")) |
|||
{ |
|||
Setters = new[] |
|||
{ |
|||
new Setter(TemplatedControl.BackgroundProperty, new SolidColorBrush(0xff777777)), |
|||
}, |
|||
}, |
|||
new Style(x => x.OfType<ToggleButton>().Class(":pointerover").Class(":pressed").Template().Name("border")) |
|||
{ |
|||
Setters = new[] |
|||
{ |
|||
new Setter(TemplatedControl.BackgroundProperty, new SolidColorBrush(0xff888888)), |
|||
}, |
|||
}, |
|||
new Style(x => x.OfType<ToggleButton>().Class(":pressed").Template().Name("border")) |
|||
{ |
|||
Setters = new[] |
|||
{ |
|||
new Setter(TemplatedControl.BorderBrushProperty, new SolidColorBrush(0xff888888)), |
|||
}, |
|||
}, |
|||
new Style(x => x.OfType<ToggleButton>().Class(":disabled").Template().Name("border")) |
|||
{ |
|||
Setters = new[] |
|||
{ |
|||
new Setter(TemplatedControl.ForegroundProperty, new SolidColorBrush(0xff7f7f7f)), |
|||
}, |
|||
}, |
|||
}); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// The default template for the <see cref="ToggleButton"/> control.
|
|||
/// </summary>
|
|||
/// <param name="control">The control being styled.</param>
|
|||
/// <returns>The root of the instantiated template.</returns>
|
|||
public static Control Template(ToggleButton control) |
|||
{ |
|||
Border border = new Border |
|||
{ |
|||
Name = "border", |
|||
Padding = new Thickness(3), |
|||
[~Border.BackgroundProperty] = control[~TemplatedControl.BackgroundProperty], |
|||
[~Border.BorderBrushProperty] = control[~TemplatedControl.BorderBrushProperty], |
|||
[~Border.BorderThicknessProperty] = control[~TemplatedControl.BorderThicknessProperty], |
|||
Child = new ContentPresenter |
|||
{ |
|||
Name = "contentPresenter", |
|||
[~ContentPresenter.ContentProperty] = control[~ContentControl.ContentProperty], |
|||
[~Layoutable.HorizontalAlignmentProperty] = control[~ContentControl.HorizontalContentAlignmentProperty], |
|||
[~Layoutable.VerticalAlignmentProperty] = control[~ContentControl.VerticalContentAlignmentProperty], |
|||
}, |
|||
}; |
|||
|
|||
return border; |
|||
} |
|||
} |
|||
} |
|||
@ -1,61 +0,0 @@ |
|||
// Copyright (c) The Perspex Project. All rights reserved.
|
|||
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
|||
|
|||
using System.Linq; |
|||
using Perspex.Controls; |
|||
using Perspex.Controls.Presenters; |
|||
using Perspex.Controls.Primitives; |
|||
using Perspex.Controls.Templates; |
|||
using Perspex.Media; |
|||
using Perspex.Styling; |
|||
|
|||
namespace Perspex.Themes.Default |
|||
{ |
|||
/// <summary>
|
|||
/// The default style for the <see cref="ToolTip"/> control.
|
|||
/// </summary>
|
|||
public class ToolTipStyle : Styles |
|||
{ |
|||
/// <summary>
|
|||
/// Initializes a new instance of the <see cref="ToolTipStyle"/> class.
|
|||
/// </summary>
|
|||
public ToolTipStyle() |
|||
{ |
|||
AddRange(new[] |
|||
{ |
|||
new Style(x => x.OfType<ToolTip>()) |
|||
{ |
|||
Setters = new[] |
|||
{ |
|||
new Setter(TemplatedControl.TemplateProperty, new FuncControlTemplate<ToolTip>(Template)), |
|||
new Setter(TemplatedControl.BackgroundProperty, new SolidColorBrush(0xffffffe1)), |
|||
new Setter(TemplatedControl.BorderBrushProperty, Brushes.Gray), |
|||
new Setter(TemplatedControl.BorderThicknessProperty, 1.0), |
|||
new Setter(TemplatedControl.PaddingProperty, new Thickness(4, 2)), |
|||
}, |
|||
}, |
|||
}); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// The default template for the <see cref="ToolTip"/> control.
|
|||
/// </summary>
|
|||
/// <param name="control">The control being styled.</param>
|
|||
/// <returns>The root of the instantiated template.</returns>
|
|||
public static Control Template(ToolTip control) |
|||
{ |
|||
return new Border |
|||
{ |
|||
[~Border.BackgroundProperty] = control[~TemplatedControl.BackgroundProperty], |
|||
[~Border.BorderBrushProperty] = control[~TemplatedControl.BorderBrushProperty], |
|||
[~Border.BorderThicknessProperty] = control[~TemplatedControl.BorderThicknessProperty], |
|||
[~Decorator.PaddingProperty] = control[~TemplatedControl.PaddingProperty], |
|||
Child = new ContentPresenter |
|||
{ |
|||
Name = "contentPresenter", |
|||
[~ContentPresenter.ContentProperty] = control[~ContentControl.ContentProperty], |
|||
} |
|||
}; |
|||
} |
|||
} |
|||
} |
|||
@ -1,162 +0,0 @@ |
|||
// Copyright (c) The Perspex Project. All rights reserved.
|
|||
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
|||
|
|||
using System.Linq; |
|||
using Perspex.Controls; |
|||
using Perspex.Controls.Presenters; |
|||
using Perspex.Controls.Primitives; |
|||
using Perspex.Controls.Shapes; |
|||
using Perspex.Controls.Templates; |
|||
using Perspex.Layout; |
|||
using Perspex.Media; |
|||
using Perspex.Styling; |
|||
|
|||
namespace Perspex.Themes.Default |
|||
{ |
|||
using Collections; |
|||
using Controls = Controls.Controls; |
|||
|
|||
/// <summary>
|
|||
/// The default style for the <see cref="TreeViewItem"/> control.
|
|||
/// </summary>
|
|||
public class TreeViewItemStyle : Styles |
|||
{ |
|||
/// <summary>
|
|||
/// Initializes a new instance of the <see cref="TreeViewItemStyle"/> class.
|
|||
/// </summary>
|
|||
public TreeViewItemStyle() |
|||
{ |
|||
AddRange(new[] |
|||
{ |
|||
new Style(x => x.OfType<TreeViewItem>()) |
|||
{ |
|||
Setters = new[] |
|||
{ |
|||
new Setter(TemplatedControl.TemplateProperty, new FuncControlTemplate<TreeViewItem>(Template)), |
|||
new Setter(Control.FocusAdornerProperty, null), |
|||
}, |
|||
}, |
|||
new Style(x => x.OfType<TreeViewItem>().Template().Name("header")) |
|||
{ |
|||
Setters = new[] |
|||
{ |
|||
new Setter(TemplatedControl.PaddingProperty, new Thickness(2)), |
|||
}, |
|||
}, |
|||
new Style(x => x.OfType<TreeViewItem>().Class(":selected").Template().Name("header")) |
|||
{ |
|||
Setters = new[] |
|||
{ |
|||
new Setter(TemplatedControl.BackgroundProperty, new SolidColorBrush(0xfff0f0f0)), |
|||
}, |
|||
}, |
|||
new Style(x => x.OfType<TreeViewItem>().Class(":selected").Class(":focus").Template().Name("header")) |
|||
{ |
|||
Setters = new[] |
|||
{ |
|||
new Setter(TemplatedControl.BackgroundProperty, new SolidColorBrush(0xff086f9e)), |
|||
new Setter(TemplatedControl.ForegroundProperty, Brushes.White), |
|||
}, |
|||
}, |
|||
new Style(x => x.OfType<TreeViewItem>().Template().OfType<ToggleButton>().Class("expander")) |
|||
{ |
|||
Setters = new[] |
|||
{ |
|||
new Setter(TemplatedControl.TemplateProperty, new FuncControlTemplate<ToggleButton>(ToggleButtonTemplate)), |
|||
}, |
|||
}, |
|||
new Style(x => x.OfType<TreeViewItem>().Template().OfType<ToggleButton>().Class("expander").Class(":checked").Template().OfType<Path>()) |
|||
{ |
|||
Setters = new[] |
|||
{ |
|||
new Setter(Visual.RenderTransformProperty, new RotateTransform(45)), |
|||
}, |
|||
}, |
|||
new Style(x => x.OfType<TreeViewItem>().Class(":empty").Template().OfType<ToggleButton>().Class("expander")) |
|||
{ |
|||
Setters = new[] |
|||
{ |
|||
new Setter(Visual.IsVisibleProperty, false), |
|||
}, |
|||
}, |
|||
}); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// The default template for the <see cref="TreeViewItem"/> control.
|
|||
/// </summary>
|
|||
/// <param name="control">The control being styled.</param>
|
|||
/// <returns>The root of the instantiated template.</returns>
|
|||
public static Control Template(TreeViewItem control) |
|||
{ |
|||
return new StackPanel |
|||
{ |
|||
Children = new Controls |
|||
{ |
|||
new Grid |
|||
{ |
|||
ColumnDefinitions = new ColumnDefinitions |
|||
{ |
|||
new ColumnDefinition(new GridLength(16, GridUnitType.Pixel)), |
|||
new ColumnDefinition(GridLength.Auto), |
|||
}, |
|||
Children = new Controls |
|||
{ |
|||
new ToggleButton |
|||
{ |
|||
Classes = new Classes("expander"), |
|||
Focusable = false, |
|||
[~~ToggleButton.IsCheckedProperty] = control[~TreeViewItem.IsExpandedProperty], |
|||
}, |
|||
new Border |
|||
{ |
|||
Name = "header", |
|||
[~Border.BackgroundProperty] = control[~TemplatedControl.BackgroundProperty], |
|||
[Grid.ColumnProperty] = 1, |
|||
Child = new ContentPresenter |
|||
{ |
|||
[~ContentPresenter.ContentProperty] = control[~HeaderedItemsControl.HeaderProperty], |
|||
}, |
|||
}, |
|||
new Rectangle |
|||
{ |
|||
Name = "focus", |
|||
Stroke = Brushes.Black, |
|||
StrokeThickness = 1, |
|||
StrokeDashArray = new PerspexList<double>(1, 2), |
|||
[Grid.ColumnProperty] = 1, |
|||
[!Rectangle.IsVisibleProperty] = control[!TreeViewItem.IsFocusedProperty], |
|||
} |
|||
} |
|||
}, |
|||
new ItemsPresenter |
|||
{ |
|||
Name = "itemsPresenter", |
|||
Margin = new Thickness(24, 0, 0, 0), |
|||
[~ItemsPresenter.ItemsProperty] = control[~ItemsControl.ItemsProperty], |
|||
[~ItemsPresenter.ItemsPanelProperty] = control[~ItemsControl.ItemsPanelProperty], |
|||
[~Visual.IsVisibleProperty] = control[~TreeViewItem.IsExpandedProperty], |
|||
} |
|||
} |
|||
}; |
|||
} |
|||
|
|||
private Control ToggleButtonTemplate(ToggleButton control) |
|||
{ |
|||
return new Border |
|||
{ |
|||
Width = 12, |
|||
Height = 14, |
|||
HorizontalAlignment = HorizontalAlignment.Center, |
|||
VerticalAlignment = VerticalAlignment.Center, |
|||
Child = new Path |
|||
{ |
|||
Fill = Brushes.Black, |
|||
HorizontalAlignment = HorizontalAlignment.Center, |
|||
VerticalAlignment = VerticalAlignment.Center, |
|||
Data = StreamGeometry.Parse("M 0 2 L 4 6 L 0 10 Z"), |
|||
} |
|||
}; |
|||
} |
|||
} |
|||
} |
|||
@ -1,65 +0,0 @@ |
|||
// Copyright (c) The Perspex Project. All rights reserved.
|
|||
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
|||
|
|||
using System.Linq; |
|||
using Perspex.Controls; |
|||
using Perspex.Controls.Presenters; |
|||
using Perspex.Controls.Primitives; |
|||
using Perspex.Controls.Templates; |
|||
using Perspex.Media; |
|||
using Perspex.Styling; |
|||
|
|||
namespace Perspex.Themes.Default |
|||
{ |
|||
/// <summary>
|
|||
/// The default style for the <see cref="TreeView"/> control.
|
|||
/// </summary>
|
|||
public class TreeViewStyle : Styles |
|||
{ |
|||
/// <summary>
|
|||
/// Initializes a new instance of the <see cref="TreeViewStyle"/> class.
|
|||
/// </summary>
|
|||
public TreeViewStyle() |
|||
{ |
|||
AddRange(new[] |
|||
{ |
|||
new Style(x => x.OfType<TreeView>()) |
|||
{ |
|||
Setters = new[] |
|||
{ |
|||
new Setter(TemplatedControl.TemplateProperty, new FuncControlTemplate<TreeView>(Template)), |
|||
new Setter(TemplatedControl.BorderBrushProperty, Brushes.Black), |
|||
new Setter(TemplatedControl.BorderThicknessProperty, 1.0), |
|||
}, |
|||
}, |
|||
}); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// The default template for the <see cref="TreeView"/> control.
|
|||
/// </summary>
|
|||
/// <param name="control">The control being styled.</param>
|
|||
/// <returns>The root of the instantiated template.</returns>
|
|||
public static Control Template(TreeView control) |
|||
{ |
|||
return new Border |
|||
{ |
|||
Padding = new Thickness(4), |
|||
[~Border.BackgroundProperty] = control[~TemplatedControl.BackgroundProperty], |
|||
[~Border.BorderBrushProperty] = control[~TemplatedControl.BorderBrushProperty], |
|||
[~Border.BorderThicknessProperty] = control[~TemplatedControl.BorderThicknessProperty], |
|||
Child = new ScrollViewer |
|||
{ |
|||
CanScrollHorizontally = true, |
|||
Content = new ItemsPresenter |
|||
{ |
|||
Name = "itemsPresenter", |
|||
MemberSelector = control.MemberSelector, |
|||
[~ItemsPresenter.ItemsProperty] = control[~ItemsControl.ItemsProperty], |
|||
[~ItemsPresenter.ItemsPanelProperty] = control[~ItemsControl.ItemsPanelProperty], |
|||
} |
|||
} |
|||
}; |
|||
} |
|||
} |
|||
} |
|||
@ -1,58 +0,0 @@ |
|||
// Copyright (c) The Perspex Project. All rights reserved.
|
|||
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
|||
|
|||
using System.Linq; |
|||
using Perspex.Controls; |
|||
using Perspex.Controls.Presenters; |
|||
using Perspex.Controls.Primitives; |
|||
using Perspex.Controls.Templates; |
|||
using Perspex.Styling; |
|||
|
|||
namespace Perspex.Themes.Default |
|||
{ |
|||
/// <summary>
|
|||
/// The default style for the <see cref="Window"/> control.
|
|||
/// </summary>
|
|||
public class WindowStyle : Styles |
|||
{ |
|||
/// <summary>
|
|||
/// Initializes a new instance of the <see cref="WindowStyle"/> class.
|
|||
/// </summary>
|
|||
public WindowStyle() |
|||
{ |
|||
AddRange(new[] |
|||
{ |
|||
new Style(x => x.OfType<Window>()) |
|||
{ |
|||
Setters = new[] |
|||
{ |
|||
new Setter(TemplatedControl.TemplateProperty, new FuncControlTemplate<Window>(Template)), |
|||
new Setter(TemplatedControl.FontFamilyProperty, "Segoe UI"), |
|||
new Setter(TemplatedControl.FontSizeProperty, 12.0), |
|||
}, |
|||
}, |
|||
}); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// The default template for the <see cref="Window"/> control.
|
|||
/// </summary>
|
|||
/// <param name="control">The control being styled.</param>
|
|||
/// <returns>The root of the instantiated template.</returns>
|
|||
public static Control Template(Window control) |
|||
{ |
|||
return new Border |
|||
{ |
|||
[~Border.BackgroundProperty] = control[~TemplatedControl.BackgroundProperty], |
|||
Child = new AdornerDecorator |
|||
{ |
|||
Child = new ContentPresenter |
|||
{ |
|||
Name = "contentPresenter", |
|||
[~ContentPresenter.ContentProperty] = control[~ContentControl.ContentProperty], |
|||
} |
|||
} |
|||
}; |
|||
} |
|||
} |
|||
} |
|||
Loading…
Reference in new issue