How to determine if a ResourceDictionary is loaded correctly

Posted by akaphenom on Stack Overflow See other posts from Stack Overflow or by akaphenom
Published on 2010-05-24T21:20:29Z Indexed on 2010/05/24 22:41 UTC
Read the original article Hit count: 526

Filed under:
|
|

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>

© Stack Overflow or respective owner

Related posts about wpf

Related posts about Silverlight