2017-02-04 6 views
0

私はブラシプロパティを持つクラスを持っており、私のwpf UserControlにはそのリストがあります。私はその価値を変更したいときは、変更のためのエディタを持っていません。これは、カテゴリー(「外観」)のようなメソッドを存在のために、このためのエディタを有効にする必要があると思いますが、私はそれを見つけることができません:(wpfのブラシエディタ

これは私のコードです:。

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)

を、私はこのような何かしたい:

BrushEditor (image)

0123を

答えて

0

「ブラシ」カテゴリの下にそれを入れてみてください:

[Category("Brush")] 
    public Brush myBrushProperty { get; set; } = Brushes.Black; 

それは、カラーピッカーのウィジェットと、それを必要とする他のプロパティとの上部に表示されます。