【发布时间】:2017-06-02 00:52:32
【问题描述】:
我有一个具有画笔属性的类,在我的 wpf UserControl 中有一个它的列表。当我想改变它的值时,它没有任何编辑器可以改变。它认为应该存在像 Category("Appearance") 这样的方法来启用编辑器,但我找不到它:( .
这是我的代码:
using System.Collections.Generic;
using System.ComponentModel;
using System.Windows.Controls;
using System.Windows.Media;
namespace Tests
{
public partial class UserControl1 : UserControl
{
List<TestBrush> brushList;
public List<TestBrush> BrushList
{
get{return brushList;}
set{brushList = value;}
}
public UserControl1()
{
InitializeComponent();
}
}
/// <summary>
/// Test Brush Class
/// </summary>
public class TestBrush
{
Brush myBrush=Brushes.Aquamarine;
[Category("Appearance")]
public Brush MyBrush
{
get{return myBrush;}
set{myBrush = value;}
}
}
}
当我想改变时,我会看到:
UserControl BrushList Property (image)
我想要这样的东西:
【问题讨论】:
标签: c# wpf user-controls brush