8
これは私の依存関係プロパティです:Winrt依存プロパティVisual Studio XAMLエラー。
public static readonly DependencyProperty ButtonTapSoundProperty = DependencyProperty.RegisterAttached("ButtonTapSound", typeof (Uri), typeof (ButtonDependencyObject), new PropertyMetadata(default(Uri), UriChanged));
私は、このようにそれを使用します。
<Button buttonDependencyObject:ButtonDependencyObject.ButtonTapSound="{Binding ElementName=TapSound}" ... />
これは、設計時と実行時に完璧に動作します。
私はこのようなコントロールテンプレートの内部でそれを定義する場合は:
<ControlTemplate x:Name="TapSound" TargetType="Button">
<Button buttonDependencyObject:ButtonDependencyObject.ButtonTapSound="{Binding ElementName=TapSound}" ... />
</ControlTemplate>
それは、実行時に動作しますが、原因はさらに、ソースコードの欠如へのVisual Studioデザイナー
ちょっと質問:ButtonのControlTemplateに別のボタンを配置しているのはなぜですか? – lokusking
なぜデザイナーではうまくいかないのですか? – MichaelThePotato
@lokuskingこれはどのコントロールテンプレート内でも起こります。 –