SourceChord

C#とXAML好きなプログラマの備忘録。最近はWPF系の話題が中心です。

Win8環境での、WPFのToggleButton表示が直ってた

以前、Win8環境でWPFのトグルボタンのIsCheckedプロパティで表示が切り替わらない、という現象を見つけました。
詳細は以下の通り。
http://d.hatena.ne.jp/minami_SC/20130331/1364729351


で、気がついたら、この表示の不具合がいつの間にか直ってました。
ちゃんと、クリックしてIsCheckedプロパティが切り替わると、トグル表示状態に反映されるようになってます。


以下のページを見たところ、パッチが出ていたようです。
http://stackoverflow.com/questions/12450751/togglebutton-doesnt-show-any-state
http://support.microsoft.com/kb/2805222

結果画像

<Window x:Class="WpfApplication1.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow"
        Width="350"
        Height="100">
    <Grid>
        <Grid ShowGridLines="True">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition />
                <ColumnDefinition />
            </Grid.ColumnDefinitions>
            <TextBlock Text="IsChecked=False" />
            <TextBlock Grid.Column="1" Text="IsChecked=True" />
            <ToggleButton Grid.Row="1"
                          Width="75"
                          Margin="5"
                          Content="Button"
                          IsChecked="False" />
            <ToggleButton Grid.Row="1"
                          Grid.Column="1"
                          Width="75"
                          Margin="5"
                          Content="Button"
                          IsChecked="True" />
        </Grid>
    </Grid>
</Window>

とりあえず、よかったよかった!!