ItemsContainerStyle に奇妙な問題があります。ItemsContainerStyle に 2 つの異なるスタイルを定義しました。
<Style x:Key="LeftAligned">
<Setter Property="FrameworkElement.HorizontalAlignment" Value="Left" />
</Style>
<Style x:Key="FullSelectionBox">
<Setter Property="FrameworkElement.HorizontalAlignment" Value="Stretch" />
</Style>
実行時にスタイルを変更します。
LogViewer.ItemContainerStyle = (Style) FindResource ("FullSelectionBox");
また
LogViewer.ItemContainerStyle = (Style) FindResource ("LeftAligned");
スタイルを変更した後、PreviewMouseLeftButtonUp、PreviewMouseRightButtonUp、または PreviewMouseUp イベントが正しく発生しません。ほとんどの場合、イベントが発生するかどうかはロシアン ルーレットです。
私のアプリケーションがこの奇妙な動作をする理由は何ですか?