I made a custom control library and made a control named "FlipView" in the root path. Then I removed the style in Generic.xaml
and moved it to its own Resource dictionary named FlipView.xaml
in the root path. Now I merge that resource dictionary into Generic.xaml
using the following code:
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/FlipView.xaml" />
</ResourceDictionary.MergedDictionaries>
Then I used the control in another wpf project, but it throws a XamlParseException
with InnerException
saying
Cannot locate resource 'flipview.xaml'.
Why can't it? The Resource Dictionary is in the root path of the control library project.
If I replace the Source
property setter with "pack://application:,,,/MyCustomControls;component/FlipView.xaml"
(MyCustomControls
is the name of my custom control library) it works perfectly fine.
Generic.xaml:
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/MyCustomControls;component/FlipView.xaml" />
</ResourceDictionary.MergedDictionaries>
Why is this the case?
For the WPF projects, this seems redundant because pack://application,,,/
refers to the root path and WpfAssemblyName;component/
again refers to the root path. Why is it necessary for Generic.xaml
?
Edit: I have seen this question but it does not explain why.