lepoco / lepoco/wpfui

ListView.ItemContainerStyle resets all Style settings

Open
#1,257 3 comments 0 reactions 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

Hello,

as an example, I am defining a ui:ListView:

<ui:ListView Grid.Row="1" Grid.ColumnSpan="1">
  <ui:ListView.View>
    <ui:GridView>
        <GridViewColumn Header="Test" Width="100">
            <GridViewColumn.CellTemplate>
                <DataTemplate>
                    <TextBlock Text="{Binding}"/>
                </DataTemplate>
            </GridViewColumn.CellTemplate>
        </GridViewColumn>
    </ui:GridView>
</ui:ListView.View>
<ListViewItem>
    <ListViewItem.Content>
        <x:Array Type="{x:Type sys:String}">
            <sys:String>Test</sys:String>
        </x:Array>
    </ListViewItem.Content>
</ListViewItem>
<ListView.ItemContainerStyle>
    <Style TargetType="ListViewItem">
    </Style>
</ListView.ItemContainerStyle>
</ui:ListView>`

As soon as

  <ListView.ItemContainerStyle>
     <Style TargetType="ListViewItem">
     </Style>
 </ListView.ItemContainerStyle>`

is applied, every Style setting from WPF-UI is gone. Also there is no possibility for BasedOn.

Am I missing something, or is that a Bug?

Thanks!

To Reproduce

See the example above.

Expected behavior

The Style settings from WPF-UI should remain, only the settings changed should be changed.

Screenshots

No response

OS version

Windows 11

.NET version

.NET 8.0

WPF-UI NuGet version

recent stable, and also on preview.

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 XAML reproduction showing an empty ListView.ItemContainerStyle on WPF-UI's ListView. Trace how that style is applied and compare the resulting control styling with the default case. Done means the WPF-UI style settings remain when a custom ItemContainerStyle is supplied, while the issue's expected behavior is covered by a regression 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
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.