Suggest:Load Skin in a sub Folder *.xaml.

Oct 30, 2008 at 3:56 AM
thanks you excellent  Dockbar control!
I want integration Dockbar in my frameWork programe.I hope use same Skin between DockBar control and my FrameWork,but your control used skin that define inside.
How can you define skin resource xaml File in a sub Folder who relatively control Assembly File.Example .\Skin.
or provide a method to set skin file .exp:SetSkin(string strFile).
I hope use below code integrate this skin.very thank!

        public bool SetStyle(string style)
        {
            string stylePath = string.Format("{0}Style\\{1}", FrameworkProvider.InstallPath, style);
            if (!Directory.Exists(stylePath))
                return false;

            ResourceDictionary resDir = new ResourceDictionary();
            string[] files = Directory.GetFiles(stylePath);
            for (int i = 0; i < files.Length; i++)
            {
                ResourceDictionary rd = new ResourceDictionary();
                try
                {
                    rd.Source = new Uri(files[i]);
                    resDir.MergedDictionaries.Add(rd);
                }
                catch (System.Exception ex)
                {
                    ExceptionProvider.CatchException(ex);
                    continue;
                }
            }
            FrameworkProvider.App.Resources = resDir;
            return true;
        }

My Programe XAML file usually defined example below:
<Page
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    x:Class="EXTECH.UBS.MainPage"
    xmlns:ad="clr-namespace:AvalonDock;assembly=AvalonDock"
    Title="MainPage" Style="{DynamicResource MainPageStyle}"
    >
MainPageStyle define in a resoure File in folder.