English 中文(简体)
• 如何将一名资源输入到其他单位?
原标题:How to import one ResourceDictionary into other, in WPF?

是否有可能将一个资源字典添加到另一个词中?

最佳回答

在Dictionary2.xaml中,Merged 理论(资源开发后的权利):

<ResourceDictionary.MergedDictionaries>
    <ResourceDictionary Source="/Path/to/Dictionary1.xaml" />
</ResourceDictionary.MergedDictionaries>

渔获量:每当你合并独裁者时,你都会有效制作合并的字典。 而且,如果你有Dictionary2.xaml和Dict4.xaml,那么你就会有三例Dictionary1.xaml制造的病例。

解决办法是。 教学法的实施应被视为一个起点,可能需要一定程度的 t,视使用情况而定。 谷歌“共享资源”用于一些 go和解决办法。

https://stackoverflow.com/questions/10380597/e-inheritance-based-different-xaml> https://stackoverflow.com/users/586553/xameli”

问题回答

我正在着手实施一个草图项目,显示如何将资源字典合并到Xaml:

<Application.Resources>
    <!-- Resources scoped at the Application level should be defined here. -->
    <ResourceDictionary>
        <ResourceDictionary.MergedDictionaries>
            <ResourceDictionary Source="/Microsoft.Expression.Prototyping.SketchControls;component/ScrollViewerStyles.xaml"/>
            <ResourceDictionary Source="/[ProjectABC];component/[fileXYZ].xaml"/>
        </ResourceDictionary.MergedDictionaries>
    </ResourceDictionary>
</Application.Resources>

这表明将另外两个资源词典合并为另一个资源词典。

(请注意,如果你在不止一个地方界定了缺省风格,因为两者将相互推翻,则命令可能变得重要)

类似:

ResourceDictionary resources = new ResourceDictionary();
resources.Source = new Uri("/MyModule;component/MyModule.xaml", 
     UriKind.RelativeOrAbsolute);
Application.Current.Resources.MergedDictionaries.Add(resources);

这正是你所期待的。 我们在我们的棱晶模块中采用这样的守则。





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签