locked
Reflection in User Control LIbrary RRS feed

  • Question

  • hi,
         I am new to wpf. i am using Expression Blend 2. i had created a User control library and named as project1, in this project1 i had created a button and created a visual brush and i had appied to ellipse . i had created another application and named as project2 . i had included project1 in project2 and i had drag the user control from asset library. now the problem is i am not getting the visual brush to ellipse, can any one suggest me. with the possibe solution.

    Regards,
    Sharath kumar
    Friday, November 20, 2009 9:48 AM

Answers

  • Hi Sharath,
                        How Control library is being referenced in the Application project? 

    [Assumption: Resources are defined in Resource Dictionary]

    [Project Reference]: Ex: Application1 has a Project reference to Control Library1 (containing Brush1 defined in ResourceDictionary1)
    1. Open App.xaml in Application project
    2. Switch to Resource Pane and link the ResourceDictionary1 in App.caml (i.e Right click on App.xaml and click on Link to Resource Dictionary)

    Using this all the resources defined in the ResourceDictionary will now be available in the Application project


    [Assembly Reference]: Ex: Application1 has assembly reference to Control Library1 (containing Brush1 defined in ResourceDictionary1)
    1. Open App.xaml in Application project
    2. Merge ResourceDictionary in Control Library project using following syntax, where ControlLibrary1 is the name of the library project.

    Also if this is a Silverlight Control Library, you will need to add x:Class="ResourceDictionary" (next to defined namespaces) in ResouceDictionary XAML file.
       

    <ResourceDictionary>

             <ResourceDictionary.MergedDictionaries>

                          <ResourceDictionary Source="/ControlLibrary1;Component/ResourceDictionary1.xaml"/>

              </ResourceDictionary.MergedDictionaries>

    </ResourceDictionary>

    Notes: Using assembly reference Blend will now be able to resolve the resources defined in the Resource Dictionary but will not provide any UI to edit these resources.

    • Proposed as answer by navits - MSFT Friday, November 20, 2009 7:13 PM
    • Marked as answer by sharathkumar11 Saturday, November 21, 2009 4:30 AM
    Friday, November 20, 2009 7:13 PM