nikobarli
Topic Author
Posts: 178
Joined: 26 Apr 2017, 06:23

Customizing UriConverter

11 Oct 2019, 08:55

Hi,

We currently place our XAMLs as follows, and access them using our custom XAML provider in our code.
<RootDir>/<DllName>/*.xaml
Now, from FirstDll/A.xaml, we want to load SecondDll/B.xaml as a resource as follows:
<ResourceDictionary Source="/SecondDll:component/B.xaml"/>
(We use this format so that Blend can also understand where to find the A.xaml)

However, the current Noesis implementation of UriConverter seems to just ignore the Packed URI's AssemblyReference path, and doesn't pass the information to our custom Xaml provider.

////////////////////////////////////////////////////////////////////////////////////////////////////
/// Converts a path in the XAML file to a valid resource path: Module/Package/ResourcePathFileName
///
/// We support the following path formats:
///     1. "RelativePath/resource.ext"
///     2. "/ReferencedAssembly;component/LocalPath/resource.ext"
///     3. "pack://application:,,,/ReferencedAssembly;component/LocalPath/resource.ext"
///
/// Example uses:
///
///     XAML File Path  : "Demos/DuckHunt/Xaml/MainWindow.xaml"
///     URI String      : "Resources.xaml"
///     Noesis Path     : "Demos/DuckHunt/Xaml/Resources.xaml"
///
///     XAML File Path  : "Demos/Browser/MainPage.xaml"
///     URI String      : "Theme/Style.xaml"
///     Noesis Path     : "Demos/Browser/Theme/Style.xaml"
///
///     XAML File Path  : "Demos/Browser/MainPage.xaml"
///     URI String      : "/Browser;component/Theme/Resources.xaml"
///     Noesis Path     : "Demos/Browser/Theme/Resources.xaml"
///
///     XAML File Path  : "Demos/Browser/MainPage.xaml"
///     URI String      : "pack://application:,,,/Browser;component/Theme/Resources.xaml"
///     Noesis Path     : "Demos/Browser/Theme/Resources.xaml"
///
////////////////////////////////////////////////////////////////////////////////////////////////////
struct UriConverter: public TypeConverter, public IXamlContextReceiver
{
...
}
Is there any workaround for this issue ?

Tags:
 
User avatar
sfernandez
Site Admin
Posts: 1938
Joined: 22 Dec 2011, 19:20

Re: Customizing UriConverter

14 Oct 2019, 10:25

Our curretn UriConverter implementation is removing all packed Uri prefixes and passing only the path part to the providers.
In order to fully support what you are explaining we probably need to do changes to our providers too.
Could you please open a ticket in our bugtracker to discuss about this?

In the meantime I can think of having your custom provider to be able to find resources in more than one root, so you can configure it to look for files under FirtstDll/ and SecondDll/ folders, and that will allow the provider to find A.xaml and B.xaml. This is not the right solution though, because it won't work when using same file names in different folders, but maybe this is not your case now.
 
nikobarli
Topic Author
Posts: 178
Joined: 26 Apr 2017, 06:23

Re: Customizing UriConverter

15 Oct 2019, 03:36

Thanks. I added a new issue here: https://www.noesisengine.com/bugs/view.php?id=1569

I will discuss with the team on how to workaround this for the moment.
 
User avatar
sfernandez
Site Admin
Posts: 1938
Joined: 22 Dec 2011, 19:20

Re: Customizing UriConverter

16 Oct 2019, 12:35

Thanks for the report.

Who is online

Users browsing this forum: Google [Bot] and 2 guests