Skip to content

Reset ListView Header don't update Layout #20966

Description

@rafael-rosa-knowcode

Current behavior 🐛

When reset a ListView.Header using runtime app, the Layout is not updated.

See on the Video that when clear the Header of the ListView using backend code, the layout still the same (using the green area of the header)
And when I clear on the XAML editor (IDE) and force Hot Reload the Header space disappears.

ListView.Header.Hide.mp4

Expected behavior 🎯

When remove the Header of the ListView, using the RunningApp, the space disappears.

How to reproduce it (as minimally and precisely as possible) 🔬

Use this sample project.

UnoAppHeader.zip

Or Create a new blank App

dotnet new unoapp -o UnoAppHeader "

And change the MainPage.xaml

<Page x:Class="UnoAppHeader.MainPage"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:local="using:UnoAppHeader"
      Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
    <ScrollViewer IsTabStop="True">
        <Grid>
            <StackPanel HorizontalAlignment="Center"
                        VerticalAlignment="Center">
                <Button Content="Click me to toggle header"
                        Width="200"
                        Height="50"
                        Margin="10"
                        Click="Button_Click" />
                <Grid Background="LightGreen"
                      Height="300"
                      Width="300">
                    <ListView Width="300"
                              x:Name="ListViewWithHeader"
                              Header="Initial ListViewHeader"
                              Height="300">
                        <ListView.Items>
                            <x:String>First Item</x:String>
                        </ListView.Items>
                        <ListView.ItemTemplate>
                            <DataTemplate>
                                <Grid  Background="Yellow">
                                    <Border Width="290" Height="280" Background="Red" />
                                </Grid>
                            </DataTemplate>
                        </ListView.ItemTemplate>
                    </ListView>
                </Grid>
            </StackPanel>
        </Grid>
    </ScrollViewer>
</Page>

and the backend MainPage.xaml.cs

namespace UnoAppHeader;

public sealed partial class MainPage : Page
{
    public MainPage()
    {
        this.InitializeComponent();
    }

    private void Button_Click(object sender, RoutedEventArgs e)
    {
        if (string.IsNullOrEmpty(ListViewWithHeader.Header?.ToString()))
        {
            ListViewWithHeader.Header = "Changed Header Text";
        }
        else
        {
            //Direct change (don't work)
            //ListViewWithHeader.Header = null;

            //Using reflection (don't work)
            var headerProperty = ListViewWithHeader.GetType().GetProperty("Header");
            if (headerProperty != null && headerProperty.CanWrite)
            {
                headerProperty.SetValue(ListViewWithHeader, null);
            }
        }
    }
}

And run the App and click on the button.

Workaround 🛠️

Change on the Xaml.
And use Hot Reload every change of the Header

Renderer 🎨

  • Skia
  • Native

Affected platforms 📱💻🖥️

All platforms 🌍

Uno.Sdk version (and other relevant versions) 📦

last dev "Uno.Sdk": "6.2.0-dev.12"

IDE version 🧑‍💻

Visual studio Version 17.14.4

Anything else we need to know? 💬

No response

Activity

  1. added
    triage/untriaged
    difficulty/tbd
    on Jul 7, 2025
  2. added
    area/hot-reload
    difficulty/medium 🤔
    and removed
    triage/untriaged
    difficulty/tbd
    on Jul 8, 2025
  3. self-assigned this
    on Jul 8, 2025
  4. nickrandolph commented on Mar 2, 2026

    @nickrandolph
    Contributor

    @ramezgerges @Jen-Uno @MartinZikmund if there are some cycles free it would be good to take a quick look at this to see if there's a quick fix. If it's more complex, we can live with it being lower in the priority queue for now

  5. self-assigned this
    on Mar 2, 2026
  6. github-actions commented on Nov 1, 2026

    @github-actions
    Contributor

    This issue has had no activity for 120 days. It will be closed in 10 days if there is no further activity. Remove the Stale label or leave a comment to keep it open.

  7. added
    stale
    on Nov 1, 2026
  8. removed
    stale
    on Nov 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area/hot-reloaddifficulty/medium 🤔

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions