Xamlから作成されたDependencyObject
を作成しようとしています。私はCannot add instance of type 'UwpApp.Xaml.TextPair' to a collection of type 'System.Collections.Generic.List<Object>
を受信し続けるUWPのコレクションタイプに `DependencyProperty`を定義する方法は?
<MyConverter x:Key="myConverter">
<MyConverter.Map>
<TextPair First="App.Blank" Second ="App.BlankViewModel"/>
</MyConverter.Map>
</MyConverter>
:
public List<object> Map
{
get { return (List<object>)GetValue(MapProperty); }
set { SetValue(MapProperty, value); }
}
// Using a DependencyProperty as the backing store for Map. This enables animation, styling, binding, etc...
public static readonly DependencyProperty MapProperty =
DependencyProperty.Register("Map", typeof(List<object>), typeof(MyConverter), new PropertyMetadata(null));
XAML: それはそうのように定義されたタイプList<object>
のDependencyProperty
を持っています。 このエラーの原因は何ですか?ありがとうございました。
このエラーの原因は簡単です: 'List
@Fruchtzwerg、私はあなたのsuggetionを試しましたが、それでも失敗します。 –
私は何の示唆もしなかったので、私は混乱しています。あなたは何を試しましたか? – Fruchtzwerg