lepoco / lepoco/wpfui

DataGridComboBoxColumn not editable

Open
#1,388 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
C#
Stars
9.6k
Forks
1k
PR merge metrics
No merged PRs in 30d

Description

Describe the bug
<DataGridComboBoxColumn Header="Anrede"
                        SelectedItemBinding="{Binding Salutation, Mode=TwoWay}"
                        ItemsSource="{Binding Source={StaticResource AvailableSalutations}, Mode=OneWay}"
                        Width="100"/>

I tried adding this DataGridComboBoxColumn to a ui:DataGrid and it shows the right value but I can't edit it.
Workaround:

<DataGridTemplateColumn Header="Anrede">
    <DataGridTemplateColumn.CellTemplate>
        <DataTemplate>
            <ComboBox ItemsSource="{Binding DataContext.ViewModel.AvailableSalutations, RelativeSource={RelativeSource AncestorType=Page}, Mode=OneWay}"
              SelectedItem="{Binding Salutation, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
              IsEditable="False"
              Background="Transparent"
              BorderThickness="0"/>
        </DataTemplate>
    </DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
To Reproduce

See examples in description.

Expected behavior

It is editable like every other column.

Screenshots

No response

OS version

Windows 11 24H2

.NET version

.NET Framework 4.8

WPF-UI NuGet version

4.0.2

Additional context

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the DataGridComboBoxColumn behavior shown in the issue and compare it with the working DataGridTemplateColumn workaround. Reproduce the binding on Windows/WPF using the supplied XAML, then verify that editing and the TwoWay SelectedItemBinding work as expected; the payload names no source file or test.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
desktop
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.