0
Controls/Templates
のイベントを書き込む方法は、ResourceDictionary
で定義されていますか?リソースディクショナリ内のコントロールのイベントハンドラを書き込む
今のところ私はevent to command strategy
を使用し、ViewModels(DataContext)
にはすべてevent
にCommands
と書いています。
public partial class ResourceDictionary
{
//...
}
をしてclass
ように指定する必要があります。このため
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
>
<Style TargetType="{x:Type TextBox}" x:Key="MyTextBox">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate>
<TextBox Width="500" Background="LightGreen" TextChanged="TextChanged" />
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>