Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add ResourceDictionary in Phone class library project and access it

I am working on a project where i have child project which is referencing the library project.

In my Library project(Phone class library) how do i create ResourceDictionary.xaml where i need to add some styles and use it in xaml files and as well as .cs files.

I need to access styles in ResourceDictionary.xaml in my xaml files as well as .cs files how to do it ?

like image 865
Goofy Avatar asked Nov 11 '22 13:11

Goofy


1 Answers

Create a folder as Generic in the root folder and have your resource files there...

To access it in XAML

  <ResourceDictionary.MergedDictionaries>
    <ResourceDictionary Source="Generic.xaml" />
  </ResourceDictionary.MergedDictionaries>

or

<ResourceDictionary.MergedDictionaries>
    <ResourceDictionary Source="/AssembleName;component/Generic.xaml" />
</ResourceDictionary.MergedDictionaries>

To access it in .cs

new URI(pack://application:,,,/AssembleName;component/Generic.xaml)
like image 180
Sankarann Avatar answered Nov 14 '22 21:11

Sankarann