質問
私の作成クラスを継承 System.Windows.Documents.Paragraph
に追加します新しいコレクション物件です。ここでは非常に簡単に表現するクラス:
public class ExtendedParagraph : Paragraph
{
public Dictionary<string, string> Attributes { get; set; }
}
いの作成と読み込みインスタンスのクラス内からの発想が求められるマークアップ構文を可能にするコンテンツ、及び、その属性のコレクションを設定することができます。
以降、段落のクラスで装飾された属性 [ContentProperty("Inlines")]
, 思いを明示的に移植のInlinesの属性ョンにします。に基づくポ書式見を解決するために用いられうことにより、同様の課題をどう考えて思ったこと。
<ExtendedParagraph xmlns="clr-namespace:MyNamespace">
<ExtendedParagraph.Inlines>
This is where the paragraph content goes
</ExtendedParagraph.Inlines>
<ExtendedParagraph.Attributes>
This is where the members of the Attributes property are declared
</ExtendedParagraph.Attributes>
</ExtendedParagraph>
しかし、このアプローチを提問題
[1]上記ポ構文解析を用いXamlReader、失敗したメッセージ"ExtendedParagraph.Inlines性が設定されていない設定することはできま"
[2]までお問い合わせくださいマークアップを使えばいいか迷っていを宣言するインスタンスのKeyValuePair内の属性が要素になります。
私は誰かにできるものは正しい方向を向いている。
多くの皆 Tim
編集なんで質問の回答[1]です。では、単純に伴宣言の属性のコレクション(利用のプロパティ要素の構文)のコンテンツの項:
<ExtendedParagraph xmlns="clr-namespace:MyNamespace">
<ExtendedParagraph.Attributes>
This is where the members of the Attributes property are declared
</ExtendedParagraph.Attributes>
This is where the paragraph content goes
</ExtendedParagraph>
しかし、declarativelyの追加メンバー Dictionary<TKey, TValue>
があります。そして今日は手がかりに このポスト, いまだに達し作業。アイディアも大歓迎です。
解決
るか、というと分からないと思いられる答えを自分の問題が、以下のいかかががんの解しています。
どうやら、支援のためのジェネリック医薬品にーは、ありませんィー machamismを生成するため、 Dictionary<TKey, TValue>
(その他の一般の収集を行っています。-
しかし、 この記事 表示していを作成することができるカスタムマークアップ拡張機能のクラスは、一度設定に合わせたコレクションメンバの型で成功を生成コレクションdeclaratively:
<ExtendedParagraph.Attributes>
<generic:DictionaryOfT TypeArgument="sys:String">
<generic:DictionaryOfT.Items>
<sys:String x:Key="String1">Hello</sys:String>
<sys:String x:Key="String2">World</sys:String>
</generic:DictionaryOfT.Items>
</generic:DictionaryOfT>
</ExtendedParagraph.Attributes>