Slash in ResourceDictionary Key not recognized
Giving one ResourceDictionary:
Create and apply a simple view model:
And use it like this:
It works fine under WPF, but Noesis (2.1.0f1 with Unity) shows:
Now it works.
But we have tens of thousands definitions using slash inside x:Key, do I have to change ALL of them?? Not to mention it's gonna cause conflicts since we also uses underscore.
Code: Select all
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:sys="clr-namespace:System;assembly=mscorlib">
<sys:String x:Key="LoginScreen/Guest">Guest</sys:String>
<sys:String x:Key="LoginScreen/Register">Register</sys:String>
<sys:String x:Key="LoginScreen/Login">Login</sys:String>
(...and the list goes on and on...)
Code: Select all
public class ViewModel
{
public ResourceDictionary Resources { get; } = LoadResourceDictionary();
}
(...inside some UserControl...)
DataContext = new ViewModel();
Code: Select all
<Button Content="{Binding Resources[LoginScreen/Login]}" Width="80" Height="25" />
Seems Noesis doesn't understand the slash character. Changing it to underscore:NoesisException: Assets/Xaml/LoginWindow.xaml(65): Unable to convert 'Resources[LoginScreen/Login]' to a valid value for property Binding.
Rethrow as NoesisException
(wrapper dynamic-method) System.Object:lambda_method(System.Runtime.CompilerServices.Closure)
Rethrow as NoesisException
Rethrow as NoesisException
(wrapper dynamic-method) System.Object:lambda_method(System.Runtime.CompilerServices.Closure)
Rethrow as NoesisException
Code: Select all
<sys:String x:Key="LoginScreen_Login">Login</sys:String>
(...)
<Button Content="{Binding Resources[LoginScreen_Login]}" Width="80" Height="25" /
But we have tens of thousands definitions using slash inside x:Key, do I have to change ALL of them?? Not to mention it's gonna cause conflicts since we also uses underscore.
-
-
sfernandez
Site Admin
- Posts: 3363
- Joined:
Re: Slash in ResourceDictionary Key not recognized
Hi, I can confirm it is a bug in our PropertyPath parser.
It will be fixed for the next release.
It will be fixed for the next release.
Who is online
Users browsing this forum: No registered users and 4 guests