Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/xamarin/Xamarin.PropertyEditing.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBertrand Le Roy <beleroy@microsoft.com>2018-02-13 04:13:12 +0300
committerBertrand Le Roy <beleroy@microsoft.com>2018-02-15 03:36:23 +0300
commitbcfb66578de2b6833028566f48d0264e9d26ee3d (patch)
treebe8b5bdb203580b066ddb72239c035caa2136851 /Xamarin.PropertyEditing.Windows.Standalone
parentf3e33678e78a6bc57e840bd1d10a7f9bd55d9ea6 (diff)
Material design color picker with Windows implementation
Diffstat (limited to 'Xamarin.PropertyEditing.Windows.Standalone')
-rw-r--r--Xamarin.PropertyEditing.Windows.Standalone/MainWindow.xaml.cs5
-rw-r--r--Xamarin.PropertyEditing.Windows.Standalone/MockedSampleControlButton.cs15
2 files changed, 18 insertions, 2 deletions
diff --git a/Xamarin.PropertyEditing.Windows.Standalone/MainWindow.xaml.cs b/Xamarin.PropertyEditing.Windows.Standalone/MainWindow.xaml.cs
index 0d5727a..eb5751a 100644
--- a/Xamarin.PropertyEditing.Windows.Standalone/MainWindow.xaml.cs
+++ b/Xamarin.PropertyEditing.Windows.Standalone/MainWindow.xaml.cs
@@ -17,6 +17,7 @@ namespace Xamarin.PropertyEditing.Windows.Standalone
InitializeComponent ();
this.panel.TargetPlatform = new TargetPlatform {
SupportsCustomExpressions = true,
+ SupportsMaterialDesign = true,
GroupedTypes = new Dictionary<Type, string> {
{ typeof(CommonBrush), "Brush" }
}
@@ -36,6 +37,7 @@ namespace Xamarin.PropertyEditing.Windows.Standalone
if (mockedControl is MockedSampleControlButton mockedButton) {
IObjectEditor editor = await this.panel.EditorProvider.GetObjectEditorAsync (inspectedObject);
await mockedButton.SetBrushInitialValueAsync (editor, new CommonSolidBrush (20, 120, 220, 240, "sRGB"));
+ await mockedButton.SetMaterialDesignBrushInitialValueAsync (editor, new CommonSolidBrush (0x65, 0x1F, 0xFF, 200));
await mockedButton.SetReadOnlyBrushInitialValueAsync (editor, new CommonSolidBrush (240, 220, 15, 190));
}
}
@@ -48,8 +50,7 @@ namespace Xamarin.PropertyEditing.Windows.Standalone
private void Theme_Click (object sender, RoutedEventArgs e)
{
- var rb = e.Source as RadioButton;
- if (rb != null) {
+ if (e.Source is RadioButton rb) {
switch (rb.Content.ToString()) {
case "Dark Theme":
PropertyEditorPanel.ThemeManager.Theme = PropertyEditing.Themes.PropertyEditorTheme.Dark;
diff --git a/Xamarin.PropertyEditing.Windows.Standalone/MockedSampleControlButton.cs b/Xamarin.PropertyEditing.Windows.Standalone/MockedSampleControlButton.cs
index 5a7765e..624d84f 100644
--- a/Xamarin.PropertyEditing.Windows.Standalone/MockedSampleControlButton.cs
+++ b/Xamarin.PropertyEditing.Windows.Standalone/MockedSampleControlButton.cs
@@ -16,6 +16,12 @@ namespace Xamarin.PropertyEditing.Windows.Standalone
colorSpaces: new[] { "RGB", "sRGB" });
MockedControl.AddProperty<CommonBrush> (this.brushPropertyInfo);
+ this.materialDesignBrushPropertyInfo = new BrushPropertyInfo (
+ name: "MaterialDesignBrush",
+ category: "Windows Only",
+ canWrite: true);
+ MockedControl.AddProperty<CommonBrush> (this.materialDesignBrushPropertyInfo);
+
this.readOnlyBrushPropertyInfo = new BrushPropertyInfo (
name: "ReadOnlySolidBrush",
category: "Windows Only",
@@ -30,6 +36,13 @@ namespace Xamarin.PropertyEditing.Windows.Standalone
this.brushSet = true;
}
+ public async Task SetMaterialDesignBrushInitialValueAsync (IObjectEditor editor, CommonBrush brush)
+ {
+ if (this.materialDesignBrushSet) return;
+ await editor.SetValueAsync (this.materialDesignBrushPropertyInfo, new ValueInfo<CommonBrush> { Value = brush });
+ this.materialDesignBrushSet = true;
+ }
+
public async Task SetReadOnlyBrushInitialValueAsync (IObjectEditor editor, CommonBrush brush)
{
if (this.readOnlyBrushSet) return;
@@ -38,8 +51,10 @@ namespace Xamarin.PropertyEditing.Windows.Standalone
}
private IPropertyInfo brushPropertyInfo;
+ private IPropertyInfo materialDesignBrushPropertyInfo;
private IPropertyInfo readOnlyBrushPropertyInfo;
private bool brushSet = false;
+ private bool materialDesignBrushSet = false;
private bool readOnlyBrushSet = false;
}
}