16/11/09 04:29:27.99 9orsc4MQ.net
>>86
>>87
業務で使う場合はViewとViewModelをきっちり分けるよ
なのでバインディング式は下記のように
<TextBox Text={Binding ResultMessage} />
シンプルになる。
View内の他の要素の値をバインドするなんて
滅多にないから(デバッグ時くらい?)、{Binding ElementName=slider1, Path=Value}
みたいな冗長な書き方はいいと思う。
装飾系も普通はResourceDictionaryにまとめる。TextBoxタグ内にゴテゴテ書いたりしない
<Window.Resources>
<ResourceDictionary>
<Style TargetType="TextBox">
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="Foreground" Value="{StaticResource GlobalForeground}" />
</Style>
</ResourceDictionary>
</Window.Resources>
キー押下時のイベント発生もViewはCommandをViewModelに発行するだけだね
<Window.InputBindings>
<KeyBinding Gesture="Ctrl+T" Command="{Binding MenuOpenCommand}" />
</Window.InputBindings>
イベント発生時の処理内容をxaml.csに記述したりはしない