Tag: WPF/DataGrid/DataGridColumn

目次[edit]

参考情報[edit]

DataGridComboBoxColumn[edit]

基本[edit]

編集可能にする[edit]

共通のItemsSourceを使う[edit]

値が表示されたり消えたり妙な動作[edit]

DataGridComboBoxでElementStyleやEditingElementStyleを指定し、かつIsSynchronizedWithCurrentItem=Trueを使うと同列の他の行の表示がみだれるのでやめたほうがよいっぽい。

                <DataGridComboBoxColumn Width="*" Header="変数の型">
                    <DataGridComboBoxColumn.ElementStyle>
                        <Style TargetType="ComboBox">
                            <Setter Property="ItemsSource" Value="{Binding Path=Types}"/>
                            <!-- これ -->
                            <Setter Property="IsSynchronizedWithCurrentItem" Value="True"/>
                            <Setter Property="DisplayMemberPath" Value="Label"/>
                            <Setter Property="IsReadOnly" Value="True"/>
                            <Setter Property="SelectedItem" Value="{Binding Type}"/>
                        </Style>
                    </DataGridComboBoxColumn.ElementStyle>
                    <DataGridComboBoxColumn.EditingElementStyle>
                        <Style TargetType="ComboBox">
                            <Setter Property="ItemsSource" Value="{Binding Path=Types}"/>
                            <!-- これ -->
                            <Setter Property="IsSynchronizedWithCurrentItem" Value="True"/>
                            <Setter Property="DisplayMemberPath" Value="Label"/>
                            <Setter Property="SelectedItem" Value="{Binding Type}"/>
                        </Style>
                    </DataGridComboBoxColumn.EditingElementStyle>
                </DataGridComboBoxColumn>

DataGridTemplateColumn[edit]

ユーザーコントロールを表示する[edit]


トップ   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS