add PropertyGrid v1
This commit is contained in:
1 parent
dea3287619
commit
0660a60e27
12 files changed
+90
-22
No files matched your search
@@ -2,20 +2,21 @@
|
||||
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}">
|
||||
Background="{DynamicResource RegionBrush}"
|
||||
DataContext="{Binding RelativeSource={RelativeSource Self}}">
|
||||
<hc:TransitioningContentControl>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<hc:PropertyGrid Width="500" SelectedObject="{Binding ElementName=PathDemo}"/>
|
||||
<Border Margin="10" Background="{DynamicResource SecondaryRegionBrush}" Style="{StaticResource BorderRegion}" Grid.Column="1" Width="300">
|
||||
<hc:SimplePanel>
|
||||
<Path Name="PathDemo" Data="{StaticResource LogoGeometry}" Stretch="Fill" MaxWidth="256" MaxHeight="256" Width="200" Height="200" Fill="#f06632" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="10"/>
|
||||
</hc:SimplePanel>
|
||||
</Border>
|
||||
<hc:Divider Margin="0,20" Orientation="Vertical" LineStrokeDashArray="2,2" Grid.Column="0" HorizontalAlignment="Right"/>
|
||||
<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>
|
||||
+21
-1
@@ -1,10 +1,30 @@
|
||||
namespace HandyControlDemo.UserControl
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user