1

Our company is trying to setup a framework with default styling for the different UWP controls and maybe even a few custom controls.

We do this in a solution i will refer to as "Core" for this post.

The different applications that we create have a reference to this Core.

In the root of Core we have a Resource Dictionary called CoreStyle.xaml which merges all the different ResourceDictionaries with Core together.

This works flawlessly using a structure as: <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="ms-appx:///Core.UWP.Presentation/ControlStyles/RelativePanel.xaml" /> <--- the Namespace here is different because it is in the same solution and it is a Project reference. </ResourceDictionary.MergedDictionaries>

Now what we would like to accomplish is the following within the App.xaml of an app: <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="ms-appx:///ChipSoft.Mobile.Core.UWP.Presentation/CoreStyle.xaml"/> <--- The Namespace here is the full namespace because it is a DLL reference </ResourceDictionary.MergedDictionaries>

For some reason this does not work however.

The exception we are getting is:

Failed to assign to property 'Windows.UI.Xaml.ResourceDictionary.Source' because the type 'Windows.Foundation.String' cannot be assigned to the type 'Windows.Foundation.Uri'. [Line: 17 Position: 37]

Does anyone have a clue how to accomplish this? Just for extra measure we are looking for a way to do this in UWP (W10), the WPF, SilverLight and even the posted above Windows 8.1 App way of doing this all do not work.

2
  • Did you see this official Application resources and localization sample? From your exception, it can be solved with Uri uri = new Uri("your string").
    – Grace Feng
    Mar 21, 2016 at 9:18
  • That's not exactly a xaml solution however now is it? I've worked around the issue for now by merging in code of the app.xaml.cs file. Our front end team doesn't really do code however and prefer xaml solutions. Something which is quite easy to do in a solution which has all needed projects inside of it. Mar 22, 2016 at 8:35

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.