Hello! How do I access the contents in a resource dictionary using C#?
for example, here is my code in XAML:
<system:String x:Key="NewGroup">New Group Name</system:String>
and i want to access it here in C#
private void OnAddGroup(object sender, ExecutedRoutedEventArgs e)
{
BooksGroupInfo group = new BooksGroupInfo();
group.GroupName = "New Group" + TheTabControl.Items.Count;
TabItem tab = AddGroup(group);
_currentLibrary.addGroup(group);
_currentLibrary.CurrentGroup = group;
}
instead of typing "New Group" in C#, i would like to replace that and have access in the resource dictionary in XAML. So the command will automatically get the Name that is in the resource dictionary.
I've tried a couple of solutions like: (System.String)this.FindResource("NewGroup"); Application.Current.Resources[typeof(System.String)]; and so on... but they do not seem to work.
I am doing a Localization using locbaml and it doesnt parse the Text/Name on C# (or i dont know how to) and that was the only solution i thought was possible. Can anyone please help me?! THANKS ALOT!