Can't understand the difference between ResourceInclude and MergeResourceInclude in mergind resources dictionaries #17915
-
Hey, I've just started experimenting with Avalonia's templated controls, and I quite immediatly ran into a problem: when trying to include my resource for the control using the following code ( as per documentation ) <ResourceDictionary.MergedDictionaries>
<MergeResourceInclude Source="/TemplatedControls/AudioPlayerController.axaml" />
</ResourceDictionary.MergedDictionaries> ( All of this is inside a Windows.Resources > ResourceDictionary ) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
In code /// <summary>
/// Loads a resource dictionary from a specified URL.
/// </summary>
/// <remarks>
/// If used from the XAML code, it is merged into the parent dictionary in the compile time.
/// When used in runtime, this type behaves like <see cref="ResourceInclude"/>.
/// </remarks>
[RequiresUnreferencedCode(TrimmingMessages.StyleResourceIncludeRequiresUnreferenceCodeMessage)]
public class MergeResourceInclude : ResourceInclude And according to its Cant tell why your previewer isn't compiling though. The previewer project doesnt have access to avares://ImagesTo2ScreenHelper? |
Beta Was this translation helpful? Give feedback.
That said, without knowing your exact use-case, it is probably more common to use
<ResourceInclude>
anyway instead of Merge -- I only use MergeResourceInclude in my Theme project that is creating large resource dictionary of all controls. And everywhere else ResourceInclude. I see this pattern in the avalonia source code as well.