从子程序集中读取父 Silverlight 项目的文件夹结构
我有一个自定义的 Silverlight 用户控件(驻留在一个单独的 DLL 中,我们将其称为 usercontrol.dll),它构建了一本简单的 3D 翻页书。我有一个引用此 DLL 的项目,该项目还有一个文件夹 Pages,其中包含所有页面。这些页面标记为“page_1.xaml、page_2.xaml、...、page_n.xaml”。一本书的页数是可变的。
我想在我的项目中使用自定义控件,如下所示:
<customControls:BookControl />
简短而甜蜜。为了使事情正常进行,我希望 BookControl 从其程序集中“伸出”到调用它的父项目,并读取“Pages”文件夹以自动将每个页面加载到书中。
我试图避免传递参数。如果 DLL 可以读取项目文件夹并创建页面列表,那么我将解决所有问题。
我现在的问题是我不知道如何调用父项目并阅读 Pages 文件夹。
如何从引用的 DLL 访问 Silverlight 项目的文件夹?
I have a custom Silverlight user control (which resides in a separate DLL we'll call usercontrol.dll) that builds a simple 3D page turning book. I have a project referencing this DLL and the project also has a folder, Pages, that contains all of the pages. The pages are labelled "page_1.xaml, page_2.xaml, ..., page_n.xaml." The number of pages in a book is variable.
I want to use the custom control in my project as follows:
<customControls:BookControl />
Short and sweet. To make things work, I want the BookControl to "reach out" from within its assembly to the parent project that is calling it and read through the "Pages" folder to automatically load each page into the book.
I'm trying to avoid passing in parameters. If the DLL can read through the projects folder and create a list of pages then I will have solved all of my problems.
My problem right now is that I don't know how to call out to the parent project and read through the Pages folder.
How can I access the folder of a Silverlight project from a referenced DLL?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
允许用户控件访问托管应用程序中的内容的最简单方法是在用户控件上放置一个属性 - 这样应用程序“传递”用户控件所需的服务/信息,而不是假设控件了解应用程序。
其中页面是页面列表
或目录名称,或者您真正需要的任何信息。
The simplest way to allow the usercontrol to access to things from the hosting application is by putting a property on the usercontrol - this way the application "hands off" the services/info required by the usercontrol, rather than the control assuming knowledge of the application.
where pages is a list of pages
or the directory name instead, or whatever info you really need.