Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[iOS] ListView Header/HeaderTemplate changes DataContext incorrectly #13173

Closed
Soap-141 opened this issue Aug 8, 2023 · 9 comments · Fixed by #14607
Closed

[iOS] ListView Header/HeaderTemplate changes DataContext incorrectly #13173

Soap-141 opened this issue Aug 8, 2023 · 9 comments · Fixed by #14607
Assignees
Labels
area/listview 📃 Categorizes an issue or PR as relevant to the ListView control kind/bug Something isn't working kind/regression Something was working, now it isn't platform/ios 🍎 Categorizes an issue or PR as relevant to the iOS platform project/items 🧾 Categorizes an issue or PR as relevant to items (ItemsControl, ItemsRepeater, ...) triage/needs-information Indicates an issue needs more information in order to work on it.

Comments

@Soap-141
Copy link

Soap-141 commented Aug 8, 2023

Current behavior

Using ListView.HeaderTemplate makes the application crash on iOS and ListView.Header is not working at all.

Expected behavior

The ListView.HeaderTemplate and ListView.Header properties should work.

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

  1. Download ListViewHeader.zip
  2. Start the application on Windows or Android
  3. Notice it works
  4. Start the application on iOS
  5. Notice it crashes, does nothing or has a black screen.

Workaround

N/A

Works on UWP/WinUI

Yes

Environment

Uno.WinUI / Uno.WinUI.WebAssembly / Uno.WinUI.Skia

NuGet package version(s)

Latest stable.

Affected platforms

iOS

IDE

Visual Studio 2022

IDE version

17.6.5

Relevant plugins

No response

Anything else we need to know?

No response

@Soap-141 Soap-141 added kind/bug Something isn't working triage/untriaged Indicates an issue requires triaging or verification difficulty/tbd Categorizes an issue for which the difficulty level needs to be defined. labels Aug 8, 2023
@Soap-141
Copy link
Author

Soap-141 commented Aug 8, 2023

@jeanplevesque jeanplevesque added the kind/regression Something was working, now it isn't label Aug 15, 2023
@Soap-141
Copy link
Author

@jeromelaban I just tried using latest Uno 5 release and it's still an issue.

@Soap-141
Copy link
Author

@takla21 can you link the backport that caused this into 4.9 please?

@jeromelaban
Copy link
Member

@Soap-141 the issue you're facing for the sample you built is #212, and it's caused by this.DataContext = this.

If you move all the DataContext in a separate class, the header is shown and the binding works with 4.9.45.

I'm closing this issue, but feel free to reopen if you have a specific behavior that is incorrect.


Here's the updated sample:

public sealed partial class MainPage : Page
{
	Model _model = new();

        public MainPage()
	{
		this.InitializeComponent();
		this.DataContext = _model;

        }

	private void Button_Click(object sender, RoutedEventArgs e)
	{
		_ = Frame.Navigate(typeof(TestPage));
	}

	private void Button_Click_1(object sender, RoutedEventArgs e)
	{
		_model.ListViewHeader.SimpleBinding += 1;
	}
}

public class Model
{
        public List<int> Source { get; } = new List<int>();

        public ListViewHeader ListViewHeader { get; } = new ListViewHeader();
}

@Soap-141
Copy link
Author

Soap-141 commented Aug 24, 2023

@jeromelaban Main issue that I'm trying to reproduce right now is that my Header DataContext is becoming null after navigation. Think it has been introduced by this https://github.com/unoplatform/uno/pull/12939/files because it wasn't happening before 4.9.45.

GitHub
GitHub Issue (If applicable): closes unoplatform/tradezero-private#8, fixes unoplatform/tradezero-private#6 PR Type What kind of change does this PR introduce?

Bugfix

What is the new behavior?
Ap...

@Soap-141
Copy link
Author

Soap-141 commented Aug 29, 2023

@jeromelaban Tagged you as asked in meeting. I will also send you a private StackTrace that I manually logged.

@jeromelaban jeromelaban reopened this Aug 29, 2023
@Soap-141
Copy link
Author

Soap-141 commented Sep 8, 2023

@jeromelaban This issue is not really updated with what we talked about behind the scenes and also not working for that client anymore but if they mentions it you know what it is.

@jeromelaban jeromelaban changed the title [iOS] ListView Header/HeaderTemplate not Working [iOS] ListView Header/HeaderTemplate changes DataContext incorrectly Sep 19, 2023
@jeromelaban
Copy link
Member

We're not able to reproduce the issue (neither with Uno 4.10.13, nor 5.0.0-dev.2656), even when navigating from one page to another. An additional test which adds and removes the ListView from the tree is still not causing the DataContext to be incorrect.

@Epsil0neR if you are able to augment this new repro to show the behavior you're getting, it will be useful, thanks!

@MartinZikmund MartinZikmund added platform/ios 🍎 Categorizes an issue or PR as relevant to the iOS platform area/listview 📃 Categorizes an issue or PR as relevant to the ListView control project/items 🧾 Categorizes an issue or PR as relevant to items (ItemsControl, ItemsRepeater, ...) difficulty/medium 🤔 Categorizes an issue for which the difficulty level is reachable with a good understanding of WinUI triage/needs-information Indicates an issue needs more information in order to work on it. and removed triage/untriaged Indicates an issue requires triaging or verification difficulty/tbd Categorizes an issue for which the difficulty level needs to be defined. difficulty/medium 🤔 Categorizes an issue for which the difficulty level is reachable with a good understanding of WinUI labels Sep 20, 2023
@Xiaoy312 Xiaoy312 self-assigned this Oct 18, 2023
@jeromelaban
Copy link
Member

This issue is fixed in 4.10.34, 5.0 latest, available on nuget.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/listview 📃 Categorizes an issue or PR as relevant to the ListView control kind/bug Something isn't working kind/regression Something was working, now it isn't platform/ios 🍎 Categorizes an issue or PR as relevant to the iOS platform project/items 🧾 Categorizes an issue or PR as relevant to items (ItemsControl, ItemsRepeater, ...) triage/needs-information Indicates an issue needs more information in order to work on it.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants