私はApp.xamlからExpressionDark.xamlを参照していますが、これは正常ですが、ItemsControlでItemContainerStyleを使用しようとすると、ItemsControlのアイテムは基本的なスタイルに戻ります。ItemContainerStyleオーバーライド汎用スタイル
<ItemsControl Grid.Column="1" VerticalAlignment="Center" Margin="10">
<ItemsControl.ItemContainerStyle>
<Style>
<Setter Property="Margin" Value="5" />
</Style>
</ItemsControl.ItemContainerStyle>
<ItemsControl.Items>
<TextBlock Text="{Binding Error}" />
<TextBox Text="{Binding Path=Username,UpdateSourceTrigger=PropertyChanged,ValidatesOnDataErrors=True}" Validation.ErrorTemplate="{StaticResource validationTemplate}"></TextBox>
<TextBox Text="{Binding Path=Password,UpdateSourceTrigger=PropertyChanged,ValidatesOnDataErrors=True}" Validation.ErrorTemplate="{StaticResource validationTemplate}"></TextBox>
<Button VerticalAlignment="Center" HorizontalAlignment="Right" Command="{Binding SignInCommand}" IsEnabled="{Binding CanSignIn}" Content="Sign In"></Button>
<TextBox Text="{Binding Path=Username}"></TextBox>
</ItemsControl.Items>
</ItemsControl>
私は(簡単にアイテム間のマージンを加え)、垂直スタイリングのための良好な制御を見つけようとしているので、多分App.xamlで指定されたスタイルをオーバーライドしないより良い方法があります。
彼らは道あなたが余裕を使用TIA
しかし、これはどのプロパティが「BasedOn」ですか? ExpressionDark.xamlにItemContainerStyleが指定されているとは思いませんでしたか? – Ian
ええと、私はあなたに誤解されているかもしれません、私はExpressionDark.xamlがスタイルだと思っていました... もしそうなら、スタイルが含まれていればそのスタイルにキーを与え、 "BasedOn" アイテムコンテナのプロパティ設定ツールを追加します。 – Notter