How to determine if a ResourceDictionary is loaded correctly
- by akaphenom
How can I tell (through the debugger if my app resources are being loaded correctly). I have tried (in f#)
type MyApp() as this =
inherit Application()
do Application.LoadComponent(this, new System.Uri("/FSSilverlightApp;component/App.xaml", System.UriKind.Relative))
let cc = new ContentControl()
let mainGrid : Grid = loadXaml("MainWindow.xaml")
let siteTemplate : Grid = mainGrid
let txt : TextBlock = siteTemplate ? txt
do
this.Startup.Add(this.startup)
let mutable s = "Items: "
s <- s + this.Resources.Count.ToString()
it is returning a count of zero. Though I am pretty sure the application is loading the resource because if I change the path within the App.xaml - I get exceptions at runtime. Other re,lavent snippets are:
I have the following app.xaml
<Application xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="Module1.MyApp">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/FSSilverlightApp;component/TransitioningFrame.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>
and content template:
<
ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<ControlTemplate x:Key="TransitioningFrame" TargetType="navigation:Frame">
<Border Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
<ContentPresenter Cursor="{TemplateBinding Cursor}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
Margin="{TemplateBinding Padding}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
Content="{TemplateBinding Content}"/>
</Border>
</ControlTemplate>
</ResourceDictionary>