我正在尝试定义一个由我自己制作的类型的设置,但我似乎无法在设置UI中的类型的ComboBox中找到我的类(也不会在由“浏览”窗体中找到在ComboBox中选择“浏览”。
如何在设置中使用自定义类?
我的课程:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Serialization;
using Key = System.Windows.Input.Key;
namespace GameOfLife
{
[Serializable()]
class KeyShortCut
{
[XmlElement("Key")]
public Key Key { get; private set; }
[XmlAttribute("Ctrl")]
public bool Ctrl { get; private set; }
[XmlAttribute("Alt")]
public bool Alt { get; private set; }
[XmlAttribute("Shift")]
public bool Shift { get; private set; }
public KeyShortCut(Key Key, bool Ctrl = false, bool Alt = false, bool Shift = false)
{
this.Key = Key;
this.Ctrl = Ctrl;
this.Alt = Alt;
this.Shift = Shift;
}
public override string ToString()
{
StringBuilder str = new StringBuilder(this.Key.ToString());
if (Ctrl)
str.Insert(0, "Ctrl + ");
if (Alt)
str.Insert(0, "Alt + ");
if (Shift)
str.Insert(0, "Shift + ");
return str.ToString();
}
}
}