Avatar of green3
green3 asked on

How to Import MS Blend Control Template into VS 2008

I have created a simple Control Template for a textbox in MS Blend stored in UserControl1.xaml. as part of my Blend Control Library Project.
I want to use this control template in my WPF application in Visual Studio 2008 .
But cant seem to get it referenced.
I have added the Blend Project dll as a reference to my VS Project.
Then I tried adding a reference to the blend control  as a resourcedictionary in Visual Studio, but this is not working. The code attached is from VS and Blend TestCtrlLib is the name of my Blend Project.

It could be the pack syntax I am using in the resource dictionary, I have tried a number of permutations of it, but still get VS error messages about the LoadFrom failing at the resource dictionary line
// Visual Studio code tryinmg to import MS Blend control template:
<UserControl x:Class="SlingChart.VisualStudio.Design.Tuner"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:Local="clr-namespace:SlingChart.VisualStudio.Design"
             xmlns:src="clr-namespace:SlingChart;assembly=SlingChart"
    Height="300" Width="300">
    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="pack://application:,,,/TestCtrlLib;component/UserControl1.xaml" />
            </ResourceDictionary.MergedDictionaries>
            </ResourceDictionary>
    </UserControl.Resources>
 
////////   MS Blend Control Template Below :
 
<UserControl x:Class="SlingChart.VisualStudio.Design.Tuner"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:Local="clr-namespace:SlingChart.VisualStudio.Design"
             xmlns:src="clr-namespace:SlingChart;assembly=SlingChart"
    Height="300" Width="300">
    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="pack://application:,,,/TestCtrlLib;component/UserControl1.xaml" />
                <ResourceDictionary Source="/SlingChart;component/Themes/ButtonsRD.xaml" />
                <ResourceDictionary Source="/SlingChart;component/Themes/TextBoxsRD.xaml" />
             -->   <ResourceDictionary Source="/SlingChart;component/Themes/TabControlsRD.xaml" /> 
            </ResourceDictionary.MergedDictionaries>
            </ResourceDictionary>
    </UserControl.Resources>

Open in new window

.NET Programming

Avatar of undefined
Last Comment
wRatte

8/22/2022 - Mon
wRatte

i'm currently having the same scenario on my hands. here's a link to something i'm working through at the moment:

http://msdn.microsoft.com/en-us/library/ms742215.aspx
ASKER CERTIFIED SOLUTION
wRatte

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
wRatte

i would've loved it if i could simply drag&drop it like a normal textbox or button control, but i recon i'll stick to the above method which worked for me.

unfortunately i haven't tried using it from a resource dictionary. if you can use your control via the 8 step summary i described above, then at least your control is working without problems and you'll know the problem lies elsewhere.
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes