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] FrameworkElement in Resources is not loaded #5208

Open
8 of 24 tasks
MartinZikmund opened this issue Feb 10, 2021 · 5 comments
Open
8 of 24 tasks

[iOS] FrameworkElement in Resources is not loaded #5208

MartinZikmund opened this issue Feb 10, 2021 · 5 comments
Assignees
Labels
difficulty/challenging 🤯 Categorizes an issue for which the difficulty level is reachable with internals understanding kind/bug Something isn't working project/layout 🧱 Categorizes an issue or PR as relevant to layouting and containers (Measure/Arrange, Collections,..) project/navigation-lifecycle 🧬 Categorizes an issue or PR as relevant to the navigation and lifecycle (NavigationView, AppBar, ...)

Comments

@MartinZikmund
Copy link
Member

Current behavior

When an element is in the Resources of another element, it's Loaded event is never called.

Expected behavior

Should be called.

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

<Grid x:Name="RootGrid" Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
  <Grid.Resources>
    <TextBlock x:Key="TestTextBlock" Text="Hello, world!" Margin="20" FontSize="30" />
  </Grid.Resources>
  <TextBlock x:Name="ResultTextBlock" Text="Not loaded" />
</Grid>
public MainPage()
{
    this.InitializeComponent();
    var textBlock = (TextBlock)RootGrid.Resources["TestTextBlock"];
    textBlock.Loaded += (s, e) =>
    {
        ResultTextBlock.Text = "Loaded!";
    };
}

Workaround

Environment

Nuget Package:

  • Uno.UI / Uno.UI.WebAssembly / Uno.UI.Skia
  • Uno.WinUI / Uno.WinUI.WebAssembly / Uno.WinUI.Skia
  • Uno.SourceGenerationTasks
  • Uno.UI.RemoteControl / Uno.WinUI.RemoteControl
  • Other:

Nuget Package Version(s):

Affected platform(s):

  • iOS
  • Android
  • WebAssembly
  • WebAssembly renderers for Xamarin.Forms
  • macOS
  • Skia
    • WPF
    • GTK (Linux)
    • Tizen
  • Windows
  • Build tasks
  • Solution Templates

IDE:

  • Visual Studio 2017 (version: )
  • Visual Studio 2019 (version: )
  • Visual Studio for Mac (version: )
  • Rider Windows (version: )
  • Rider macOS (version: )
  • Visual Studio Code (version: )

Relevant plugins:

  • Resharper (version: )

Anything else we need to know?

@MartinZikmund MartinZikmund added kind/bug Something isn't working triage/untriaged Indicates an issue requires triaging or verification project/layout 🧱 Categorizes an issue or PR as relevant to layouting and containers (Measure/Arrange, Collections,..) and removed triage/untriaged Indicates an issue requires triaging or verification labels Feb 10, 2021
@MartinZikmund
Copy link
Member Author

I'm sorry, @davidjohnoliver 😅

@davidjohnoliver
Copy link
Contributor

Really, Loaded gets called on views that are in Resources?? Also, why are you putting views in Resources??? You're killing me @MartinZikmund 😅

@MartinZikmund
Copy link
Member Author

Really, Loaded gets called on views that are in Resources?? Also, why are you putting views in Resources??? You're killing me @MartinZikmund 😅

Not intentionally though 😂... Many samples (and runtime tests) of TeachingTip have the control in Resources. Then the tests wait for Loaded to be invoked and I was trying to figure out why the app just froze... So that's why 😀😀

@jeromelaban jeromelaban added the difficulty/tbd Categorizes an issue for which the difficulty level needs to be defined. label Feb 15, 2021
@MartinZikmund MartinZikmund added difficulty/challenging 🤯 Categorizes an issue for which the difficulty level is reachable with internals understanding project/navigation-lifecycle 🧬 Categorizes an issue or PR as relevant to the navigation and lifecycle (NavigationView, AppBar, ...) and removed difficulty/tbd Categorizes an issue for which the difficulty level needs to be defined. labels Jun 4, 2021
@MartinZikmund MartinZikmund changed the title FrameworkElements in Resources are not loaded FrameworkElement in Resources is not loaded Jun 14, 2023
@MartinZikmund MartinZikmund changed the title FrameworkElement in Resources is not loaded FrameworkElement in Resources is not loaded Jun 14, 2023
@Youssef1313
Copy link
Member

I think this is where it happens in WinUI.

image

@MartinZikmund
Copy link
Member Author

Will handle the iOS part

@Youssef1313 Youssef1313 removed their assignment Mar 5, 2024
@MartinZikmund MartinZikmund changed the title FrameworkElement in Resources is not loaded [iOS] FrameworkElement in Resources is not loaded Mar 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
difficulty/challenging 🤯 Categorizes an issue for which the difficulty level is reachable with internals understanding kind/bug Something isn't working project/layout 🧱 Categorizes an issue or PR as relevant to layouting and containers (Measure/Arrange, Collections,..) project/navigation-lifecycle 🧬 Categorizes an issue or PR as relevant to the navigation and lifecycle (NavigationView, AppBar, ...)
Projects
None yet
Development

No branches or pull requests

4 participants