You can manually edit the overall project to set the build action for the resource dictionary.
The general project consists of Project.shproj and Project.projitems , open the second one and find the dictionary there:
<ItemGroup> <None Include="$(MSBuildThisFileDirectory)Dictionary.xaml" /> </ItemGroup>
Add after that
<ItemGroup> <Page Include="$(MSBuildThisFileDirectory)Dictionary.xaml"> <Generator>MSBuild:Compile</Generator> <SubType>Designer</SubType> </Page> </ItemGroup>
this is copy / paste from regular csproj for a WPF project containing a dictionary.
It seems to work, although this build action is not displayed when the project loads in Visual Studio. Adding files to a shared project does not affect this change manually.
Now I can have a generic project containing a resource dictionary, yay!
The resource dictionary can be combined into application dictionaries, for example, if it is located in the root of the project (use as a static / dynamic resource in the xaml designer):
<Application.Resources> <ResourceDictionary > <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="Dictionary.xaml" /> </ResourceDictionary.MergedDictionaries> </ResourceDictionary> </Application.Resources>
and / or loaded manually, for example. using pack Uri :
var dictionary = new ResourceDictionary() { Source = new Uri("pack://application:,,,/FlexProperty.xaml"), };
Sinatr
source share