Customizing UriConverter
Hi,
We currently place our XAMLs as follows, and access them using our custom XAML provider in our code.
Now, from FirstDll/A.xaml, we want to load SecondDll/B.xaml as a resource as follows:
(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.
Is there any workaround for this issue ?
We currently place our XAMLs as follows, and access them using our custom XAML provider in our code.
Code: Select all
<RootDir>/<DllName>/*.xaml
Code: Select all
<ResourceDictionary Source="/SecondDll:component/B.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.
Code: Select all
////////////////////////////////////////////////////////////////////////////////////////////////////
/// 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
{
...
}
-
-
sfernandez
Site Admin
- Posts: 2028
- Joined:
Re: Customizing UriConverter
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.
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.
Re: Customizing UriConverter
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.
I will discuss with the team on how to workaround this for the moment.
Who is online
Users browsing this forum: No registered users and 0 guests