2
ResourceDictionary
이라는 IDictionary
을 상속하는 클래스가 있습니다.
또한 DictionaryKeyProperty
이라는 이름의 또 다른 클래스가 있습니다. 이름은 Style
입니다.
DictionaryKeyProperty
의 이름은 TargetType
입니다.각 사전 항목에는 연관된 키가 있어야합니다.
XAML 파일 내용 :
<ResourceDictionary
xmlns="clr-namespace:Test;assembly=Test"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
<Style TargetType="test" />
</ResourceDictionary>
그것은 오류 내가 잘못 뭐하는 거지 Each dictionary entry must have an associated key.
public class ResourceDictionary : IDictionary, ICollection, IEnumerable, INameScope, ISupportInitialize
{
...
}
[ContentProperty("Setters"), DictionaryKeyProperty("TargetType")]
public class Style : Sealable, INameScope, IQueryAmbient, IResources
{
private Type _TargetType;
[Ambient]
public Type TargetType
{
get { return _TargetType; }
set
{
CheckSealed();
if (value == null)
throw new ArgumentNullException("value");
_TargetType = value;
}
}
......
}
을주고있다?
이 문제를 어떻게 해결할 수 있습니까?
P .: WPF와 같은 종속성 시스템을 포함하는 가벼운 프레임 워크를 만들고 싶습니다.
이 대답은 무엇입니까? 또는 새로운 질문? 나는 결정할 수 없다. 당신이 질문을 제거하고 그가 어떻게'Dictionary'를 대신 사용할 수 있는지 설명 할 수 있을까요? – Default
작은 프레임 워크를 만들려면 System.Xaml 만 사용하고 WPF는 포함시키지 마십시오. – Kation
자세한 내용을 확인하십시오. 나는 너를 따라갈 수 없어. –