I have a doubt: Can I load external resources (for example ResourceDictionaries) from xaml files to use them on my indicators ?
I created a simple ResourceDictionary and saved it as myresource.xaml inside the Indicators folder. This is the code in myresources.xaml file:
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:ComponentModel="clr-namespace:System.ComponentModel;assembly=WindowsBa se" >
<DataTemplate x:Key="mydatatemplate">
<StackPanel VirtualizingPanel.IsVirtualizing="True">
<TextBlock Text="{Binding}" ToolTip="{Binding}" FontFamily="{Binding}" />
</StackPanel>
</DataTemplate>
</ResourceDictionary>
But when I want use it on my indicator, an exception is thrown because the resource was not found. This code fails:
Application.Current.Resources.MergedDictionaries.A dd(new ResourceDictionary() { Source = foo });
DataTemplate dt = Application.Current.FindResource("mydatatemplate") as DataTemplate;
Print(dt.ToString() );
However, this works ok on Visual Studio.
Thanks.
Comment