Merge pull request #409 from HandyOrg/add-PropertyEditor

Add property editor
This commit is contained in:
NaBian authored and GitHub committed 2020-06-19 01:16:46 +08:00
commit e57340f1c2
50 files changed
+1080 -11

No files matched your search

@@ -40,6 +40,7 @@
"selectedIndex": 0,
"demoItemList": [
[ "FloatingBlock", "FloatingBlockDemoCtl", "thumbs_up", "" ],
[ "PropertyGrid", "PropertyGridDemoCtl", "PropertyGridEditorPart_16x", "1" ],
[ "ImageBlock", "ImageBlockDemoCtl", "ImageStack_16x", "" ],
[ "Magnifier", "MagnifierDemoCtl", "Search_16x", "" ],
[ "Gravatar", "GravatarDemoCtl", "User_16x", "" ],
@@ -55,7 +56,7 @@
[ "TextBox", "TextBoxDemoCtl", "TextBox_16x", "" ],
[ "ComboBox", "ComboBoxDemoCtl", "ComboBox_16x", "" ],
[ "PasswordBox", "PasswordBoxDemoCtl", "PasswordBox_16x", "" ],
[ "PinBox", "PinBoxDemoCtl", "Ellipsis_16x", "1" ],
[ "PinBox", "PinBoxDemoCtl", "Ellipsis_16x", "" ],
[ "DatePicker", "DatePickerDemoCtl", "DatePicker_16x", "" ],
[ "Clock", "ClockDemoCtl", "Time_color_16x", "" ],
[ "TimePicker", "TimePickerDemoCtl", "TimePicker_16x", "" ],
@@ -0,0 +1,25 @@
using System.ComponentModel;
namespace HandyControlDemo.Data
{
public class PropertyGridDemoModel
{
[Category("Info")]
public string Name { get; set; }
[Category("Achievement")]
public int Score { get; set; }
[Category("Achievement")]
public bool IsPassed { get; set; }
[Category("Info")]
public Gender Gender { get; set; }
}
public enum Gender
{
Male,
Female
}
}
@@ -19,6 +19,7 @@
<Compile Include="$(MSBuildThisFileDirectory)Data\Model\CardModel.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Data\Model\ChatInfoModel.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Data\Model\AvatarModel.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Data\Model\PropertyGridDemoModel.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Data\Model\CoverViewDemoModel.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Data\Model\DemoDataModel.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Data\Model\DemoInfoModel.cs" />
@@ -84,6 +85,9 @@
<Compile Include="$(MSBuildThisFileDirectory)UserControl\Controls\PinBoxDemoCtl.xaml.cs">
<DependentUpon>PinBoxDemoCtl.xaml</DependentUpon>
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)UserControl\Controls\PropertyGridDemoCtl.xaml.cs">
<DependentUpon>PropertyGridDemoCtl.xaml</DependentUpon>
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)UserControl\Controls\RangeSliderDemoCtl.xaml.cs">
<DependentUpon>RangeSliderDemoCtl.xaml</DependentUpon>
</Compile>
@@ -548,6 +552,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="$(MSBuildThisFileDirectory)UserControl\Controls\PropertyGridDemoCtl.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="$(MSBuildThisFileDirectory)UserControl\Controls\RangeSliderDemoCtl.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
@@ -1337,7 +1337,18 @@ namespace HandyControlDemo.Properties.Langs {
return ResourceManager.GetString("Project", resourceCulture);
}
}
/// <summary>
/// 查找类似 属性编辑器 的本地化字符串。
/// </summary>
public static string PropertyGrid
{
get
{
return ResourceManager.GetString("PropertyGrid", resourceCulture);
}
}
/// <summary>
/// 查找类似 按住说话 的本地化字符串。
/// </summary>
@@ -750,4 +750,7 @@
<data name="LangComment" xml:space="preserve">
<value>Looks up a localized string similar to "{0}".</value>
</data>
<data name="PropertyGrid" xml:space="preserve">
<value>PropertyGrid</value>
</data>
</root>
@@ -750,4 +750,7 @@
<data name="LangComment" xml:space="preserve">
<value>Looks up a localized string similar to "{0}".</value>
</data>
<data name="PropertyGrid" xml:space="preserve">
<value>PropertyGrid</value>
</data>
</root>
@@ -750,4 +750,7 @@
<data name="LangComment" xml:space="preserve">
<value>Looks up a localized string similar to "{0}".</value>
</data>
<data name="PropertyGrid" xml:space="preserve">
<value>PropertyGrid</value>
</data>
</root>
@@ -750,4 +750,7 @@
<data name="LangComment" xml:space="preserve">
<value>Looks up a localized string similar to "{0}".</value>
</data>
<data name="PropertyGrid" xml:space="preserve">
<value>PropertyGrid</value>
</data>
</root>
@@ -750,4 +750,7 @@
<data name="LangComment" xml:space="preserve">
<value>查找类似 {0} 的本地化字符串。</value>
</data>
<data name="PropertyGrid" xml:space="preserve">
<value>属性编辑器</value>
</data>
</root>
@@ -750,4 +750,7 @@
<data name="LangComment" xml:space="preserve">
<value>Looks up a localized string similar to "{0}".</value>
</data>
<data name="PropertyGrid" xml:space="preserve">
<value>PropertyGrid</value>
</data>
</root>
@@ -750,4 +750,7 @@
<data name="LangComment" xml:space="preserve">
<value>Looks up a localized string similar to "{0}".</value>
</data>
<data name="PropertyGrid" xml:space="preserve">
<value>PropertyGrid</value>
</data>
</root>
@@ -179,7 +179,8 @@ namespace HandyControlDemo.Properties.Langs
OnPropertyChanged(nameof(ProgressBar));
OnPropertyChanged(nameof(ProgressButton));
OnPropertyChanged(nameof(Project));
OnPropertyChanged(nameof(PushToTalk));
OnPropertyChanged(nameof(PropertyGrid));
OnPropertyChanged(nameof(PushToTalk));
OnPropertyChanged(nameof(QQGroup));
OnPropertyChanged(nameof(RadioButton));
OnPropertyChanged(nameof(RangeSlider));
@@ -960,6 +961,11 @@ namespace HandyControlDemo.Properties.Langs
/// </summary>
public string Project => Lang.Project;
/// <summary>
/// 查找类似 属性编辑器 的本地化字符串。
/// </summary>
public string PropertyGrid => Lang.PropertyGrid;
/// <summary>
/// 查找类似 按住说话 的本地化字符串。
/// </summary>
@@ -2024,6 +2030,11 @@ namespace HandyControlDemo.Properties.Langs
/// </summary>
public static string Project = nameof(Project);
/// <summary>
/// 查找类似 属性编辑器 的本地化字符串。
/// </summary>
public static string PropertyGrid = nameof(PropertyGrid);
/// <summary>
/// 查找类似 按住说话 的本地化字符串。
/// </summary>
Binary file not shown.

After

Width:  |  Height:  |  Size: 173 B

@@ -0,0 +1,22 @@
<UserControl x:Class="HandyControlDemo.UserControl.PropertyGridDemoCtl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:hc="https://handyorg.github.io/handycontrol"
Background="{DynamicResource RegionBrush}"
DataContext="{Binding RelativeSource={RelativeSource Self}}">
<hc:TransitioningContentControl>
<Grid Margin="22">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<hc:PropertyGrid Width="500" SelectedObject="{Binding DemoModel}"/>
<StackPanel Grid.Row="1" Margin="10,16,10,10">
<TextBox hc:TitleElement.Title="Name" hc:TitleElement.TitlePlacement="Left" Style="{StaticResource TextBoxExtend}" Text="{Binding DemoModel.Name,Mode=OneWay}" IsReadOnly="True"/>
<TextBox hc:TitleElement.Title="Gender" hc:TitleElement.TitlePlacement="Left" Style="{StaticResource TextBoxExtend}" Text="{Binding DemoModel.Gender,Mode=OneWay}" IsReadOnly="True" Margin="0,6,0,0"/>
<TextBox hc:TitleElement.Title="Score" hc:TitleElement.TitlePlacement="Left" Style="{StaticResource TextBoxExtend}" Text="{Binding DemoModel.Score,Mode=OneWay}" IsReadOnly="True" Margin="0,6,0,0"/>
<TextBox hc:TitleElement.Title="IsPassed" hc:TitleElement.TitlePlacement="Left" Style="{StaticResource TextBoxExtend}" Text="{Binding DemoModel.IsPassed,Mode=OneWay}" IsReadOnly="True" Margin="0,6,0,0"/>
</StackPanel>
</Grid>
</hc:TransitioningContentControl>
</UserControl>
@@ -0,0 +1,30 @@
using System.Windows;
using HandyControlDemo.Data;
namespace HandyControlDemo.UserControl
{
public partial class PropertyGridDemoCtl
{
public PropertyGridDemoCtl()
{
InitializeComponent();
DemoModel = new PropertyGridDemoModel
{
Name = "TestName",
Gender = Gender.Female,
IsPassed = true,
Score = 98
};
}
public static readonly DependencyProperty DemoModelProperty = DependencyProperty.Register(
"DemoModel", typeof(PropertyGridDemoModel), typeof(PropertyGridDemoCtl), new PropertyMetadata(default(PropertyGridDemoModel)));
public PropertyGridDemoModel DemoModel
{
get => (PropertyGridDemoModel) GetValue(DemoModelProperty);
set => SetValue(DemoModelProperty, value);
}
}
}