x:Uid in Resource Dictionary causing unhandled exception in Universal Apps?? RRS feed

  • Question

  • Hello,

    I have a Universal app, in which I have two separated MainPages for Windows 8.1 and Windows Phone 8.1 apps, and two separated Resource Dictionaries ( Style.xaml ) for both the apps.

    In the Windows 8.1 app I have a GridView in MainPage.xaml with a custom ItemTemplate:

                <GridView ItemTemplate="{StaticResource ItemTempl}" ItemsSource="{Binding}"  />

    ItemTempl is defined in another file, called Style.xaml, which is a Resource Dictionary:

      <TextBlock Visibility="{Binding itsok, Converter={StaticResource Bool2Visibility}}" x:Uid="oktext" />

    In MainPage.xaml.cs I am binding a collection of items which have a bool "itsok" property. When itsok is true, my converter will set the TextBlock Visibility to Visible, and the TextBlock will show my LOCALIZED text, as I have a Resources.resw file in the SHARED project which contains the oktext.Text definition inside ( the text is "Yeah, it's ok!!! :) " ).

    The problem:

    If I use the x:Uid="oktext" in ItemTempl, which is defined in Style.xaml, I get an unhandledException!!!

    If I delete x:Uid="oktext" in ItemTempl, which is defined in Style.xaml, I get no exceptions.

    If I use the x:Uid="oktext" in ItemTempl defining it INSIDE MainPage.xaml instead of Style.xaml, it works....

    I didn't have this problem in Non-Universal Apps!!!

    So, how can I continue using x:Uid="oktext" defining ItemTempl in Style.xaml?? I need it because I need to reuse this ItemTemplate!

    Friday, May 23, 2014 10:48 AM

All replies

  • Can you share on OneDrive a minimal repro sample which demonstrates the problem?

    I'm not quite understanding how you have everything laid out here.

    Saturday, May 24, 2014 12:10 AM