在 WPF 用户控件库中隐藏控件 [英] Hide control within a WPF User Control Library
问题描述
我有一个由 Visual Studio 中的WPF 用户控件库"模板制作的项目.该项目包含一个主要的用户控件和附加的 Windows/用户控件.
I've a project made from the "WPF User Control Library" Template in Visual Studio. This project contains one main usercontrol plus additional Windows/Usercontrols.
我如何隐藏"这些额外的 Windows/用户控件,以便用户只能从程序集中导入主用户控件(我想放一个屏幕截图来说明我的问题,但不幸的是,我的声誉"太低!).
How can I "hide" these additional Windows/Usercontrols, so that the user can only import the main usercontrol from the assembly (I wanted to put a screen-shot to illustrate my question but unfortunately, my "reputation" is too low!).
感谢所有
弗雷德
Thx All
Fred
推荐答案
使这些控件成为内部控件.如果您有带有 XAML 和代码隐藏的经典用户控件,则需要将 x:ClassModifier="internal"
添加到 XAML 中的根元素:
Make those controls internal. If you have classic UserControls with XAML and codebehind you will need to add x:ClassModifier="internal"
to the root element in the XAML:
<UserControl
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="MyNameSpace.MyUserControl"
x:ClassModifier="internal">
<!-- bla -->
</UserControl>
这篇关于在 WPF 用户控件库中隐藏控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!