Skip to content

[DataTemplate][Windows] Property Not Found Exception at Styles/Generic.xaml #19977

Closed

Description

@DevTKSS

Current behavior

Somehow Xaml Compiler does not find a Property in a DataTemplate Definition there, but its not altering from all the other DataTemplate Definitions, imported as ResourceDictionary and should be fine...

Image
Image

Expected behavior

Should not throw issue?

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

Build the app from this commit: DevTKSS/DevTKSS.Uno.SampleApps@50db97b

(will apply workaround meanwile I dont know the problem source at later commits)

Workaround

as they has been in the page resources that was not happening, so will revert those Refactoring to that central StaticResource as Workaround
Not Rebuild or Build Solution only run debug?

Works on UWP/WinUI

Debug Run target Desktop builds, but "(Re)build Solution" after "Clean Solution" does throw this issue only for the additional Windows target, which is not targeted by debug...

Image

Environment

No response

NuGet package version(s)

No response

Affected platforms

Build tasks

IDE

Visual Studio 2022

IDE version

17.13.6

Relevant plugins

No response

Anything else we need to know?

Added Assets/Samples/**.txt files which are containing xaml copyed code, which are throwing an Issue when used as UnoAsset available as BuildAction, but not documented? set them to Resources but dont know if thats the correct setting when I want to load them with IStorage at runtime and this could cause this issue also

Activity

  1. added
    difficulty/tbd
    kind/bug
    triage/untriaged
    on Apr 19, 2025
  2. changed the title [-][DataTemplate] Property Not Found Exception at Styles/Generic.xaml ?[/-] [+][DataTemplate][Windows] Property Not Found Exception at Styles/Generic.xaml[/+] on Apr 19, 2025
  3. DevTKSS commented on May 9, 2025

    @DevTKSS
    ContributorAuthor

    Dont know what exactly that is sourcing in but at current last stable of this repo (parent of "delete SampleCode" commit) its not showing it. But the styles are not theme responsive which makes the resourced DataTemplates not really pretty...

  4. jeromelaban commented on May 9, 2025

    @jeromelaban
    Member

    This is an odd error. As it's a WinAppSDK error, the only way around it is to find a workaround, there's generally no fix that we can make in Uno that can help.

  5. DevTKSS commented on May 9, 2025

    @DevTKSS
    ContributorAuthor

    Hm since the theme taken from the material toolkit is not theme responsive, can you tell if you might see the reason for this when its set to desktop and not Windows target? All I could consider is just not name any styles and so on but thats nor really cool as you will know... Maybe I did oversee something? 😅

  6. DevTKSS commented on Jun 29, 2025

    @DevTKSS
    ContributorAuthor

    @jeromelaban I tryed that days to re-activate the windows target on the app as I only dragged the target out of the TargetFrameworks and commented it out... Still not building to windows target with 6.0.146 🤔 I dont have any idea whats causing this...

    do you maybe have any known workaround I could use for unsing a ResourceDictionary through the Material Toolkit provided MergedDictionarys in my App.xaml? Readed from one of the MS MVP on our discord server that he knowing the page resources as more unreliable and preferres the app approach... Will see if I find the name to link him, maybe he has a idea for this...

  7. DevTKSS commented on Jun 29, 2025

    @DevTKSS
    ContributorAuthor

    @AndrewKeepCoding Do you have any idea why this is happening or how I could make this project build also properly to windows but using a central ResourceDictionary for DataTemplates?

    Linking to the src directory of the app I tested it last days on to include again...

    https://github.com/DevTKSS/DevTKSS.Uno.SampleApps/tree/master/src%2FDevTKSS.Uno.Samples.MvuxGallery

    To Desktop target thats not problem at all, but as soon as its to windows target, no chance...

  8. AndrewKeepCoding commented on Jul 1, 2025

    @AndrewKeepCoding
    Contributor

    @DevTKSS x:Bind or x:DataType requires a code-behind cs file. Something like this:

    Styles/Generic.xaml.cs

    namespace DevTKSS.Uno.Samples.MvuxGallery.Styles;
    
    public partial class Generic : ResourceDictionary
    {
        public Generic()
        {
            InitializeComponent();
        }
    }

    Styles/Generic.xaml

    <ResourceDictionary x:Name="MyStyleTemplates"
        x:Class="DevTKSS.Uno.Samples.MvuxGallery.Styles.Generic"
        ....

    microsoft/microsoft-ui-xaml#10571

    It might be worth considering a different file (class) name, ThemeResources.xaml/ThemeResources.xaml.cs maybe?

    That said, now you'll get the following exception:

    The text associated with this error code could not be found.
    Cannot find a Resource with the Name/Key DefaultPersonPictureStyle [Line: 82 Position: 17]
    

    Adding the XamlControlsResources in Generic.xaml doesn't help.

    <ResourceDictionary.MergedDictionaries>
        <XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls" />
    </ResourceDictionary.MergedDictionaries>

    I'm still not sure if this comes from Uno or WinUI. Removing that line fixes the issue, though it seems that you don't need the default style there.

  9. DevTKSS commented on Jul 1, 2025

    @DevTKSS
    ContributorAuthor

    @AndrewKeepCoding that's for checking on this! Indeed I think as I were creating this ResourcesDictionary file, I used the uno docs guide for defining own template librarys🤔 will check on the advised name there and if that name is indeed advised like this there I will make a quick PR to fix this doc, so others will not stumble over this in the future and not knowing why thats happening 😅

    To the Codebehind and this also in my case applies to the Control templates aka CustomControl/UserControl:

    I think Jeromé told me in the past on discord server that there is kind of a limitation for this in mvux apps😅
    if I remember correctly, this requires to do it in an mvvm approach (=>which could potentially cause problems if used alongside with mvvm feature) and trying it although to do it in mvux did cause already problems in the same app spoken of, in one of the first commits, when I tryed to define and use a CustomControl for the "GridListViewHeader" i think I did name it, which I did bind or targeted to bind to the mvux:FeedView using a mvux generated Command. Lastly the hot Reload had problems updating changes in there.

    @jeromelaban I would not remember reded this remark to CustomControl -mvux vs. Mvvm on the Docs. Could this information, including a simple but usable workaround advose, get considered to be added by someone of maybe the team or any deeper involved and knowing person to the appropriate docs until this might be resolved in the future?

    Additionaly reason for me trying to add such CustomControl:

    Setting all the callbacks up for enabling disabling and so on were adding so much boilerplate that I also requested a enhancement to get a HeaderTemplate that could be added to ListView AND Gridview as both of them are inheriting in uno from the ListViewBase I think that was called. Its in the contributing>internals docs.
    So by that we could already bind to the FeedView that could include already the refresh bound or re-use this template for both view kinds😅 added a feature request at January I think but so far, seems like nobody had time to even take a look on this to consider.
    Therefore my only way to workaround this were using DataTemplates with AncestorBinding or Binding with Parent in-between.

  10. AndrewKeepCoding commented on Jul 1, 2025

    @AndrewKeepCoding
    Contributor

    @DevTKSS The naming suggestion is just a tip for better naming. I don't believe it's the root of the issue here.

  11. DevTKSS commented on Jul 1, 2025

    @DevTKSS
    ContributorAuthor

    @Jen-Uno maybe the external linked DataTemplate issue should get added to the external follow up Microsoft epic pinned issues list?

  12. added theissue type on Jul 2, 2025
  13. removed
    kind/bug
    on Jul 2, 2025
  14. Jen-Uno commented on Jul 2, 2025

    @Jen-Uno
    Contributor

    @DevTKSS I will check with @jeromelaban

  15. jeromelaban commented on Jul 9, 2025

    @jeromelaban
    Member

    I've added the issue to the #982

  16. added
    area/external
    and removed
    triage/untriaged
    difficulty/tbd
    on Jul 9, 2025
  17. github-actions commented on May 12, 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.

  18. added
    stale
    on May 12, 2026
  19. removed
    stale
    on May 12, 2026
  20. MartinZikmund commented on May 18, 2026

    @MartinZikmund
    Member

    Thanks for the detailed investigation here, and thanks @AndrewKeepCoding for digging in. As Jerome mentioned, this error originates on the WinAppSDK side when targeting Windows directly, so there's no fix we can apply from Uno itself. We've already linked this scenario to our external Microsoft follow-up umbrella at #982, so I'll go ahead and close this one to keep things tidy — please continue to track progress there. If you'd like upstream visibility, filing it on https://github.com/microsoft/microsoft-ui-xaml is the most effective path.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/external

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions