本文介绍了用户控制问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在LightSwitch中创建用户控件时遇到了一个普遍的问题.尽管原因可能不一定与LightSwitch本身有关.

I've got a general problem with creating user controls within LightSwitch. Although the reason might not necessarily be related to LightSwitch itself.

我正在尝试创建一个自定义控件.我找到了一些有关如何做的教程.他们都遵循相同的场景,并在同一地点阻止我.在Silverlight中创建新的控制器类之后,我无法将其添加到我的自定义控件列表中 在LightSwitch中.我按添加参考按钮.我发现我刚刚创建的控制器,当我单击确定"时,新类不会出现在列表顶部.

I am trying to create a custom control. I have found couple of tutorials on how to do it. All of them follow the same scenario and stop me in the same place. Just after creating a new controller class in Silverlight I can't add it to my custom control list in LightSwitch. I press add reference button. I find controller I have just created and when I click "ok", the new class does not appear on top of the list.

这是我尝试遵循的其中一个教程的链接:

This is a link to one of the tutorials I was trying to follow:

http://geekswithblogs.net/ebartolesi/archive/2011/08/08/create-a-custom-control-in-a-lightswitch-application.aspx

http://geekswithblogs.net/ebartolesi/archive/2011/08/08/create-a-custom-control-in-a-lightswitch-application.aspx

 

请帮助!!!

 

Bartosz

推荐答案

使用自定义控件的方法是在屏幕的设计器中,将现有控件添加或设置为自定义控件".如果选择添加"->新建自定义控件",则用于选择程序集的窗口将出现,并显示特定的控件,您还可以在其中设置DataContext. 如果您将现有控件(例如文本框)更改为屏幕右侧的自定义控件(控件属性所在的位置),您将看到类似这样的内容.

The way to use your custom control is in the designer of a screen either add or set an existing control to Custom Control. If you choose Add->New Custom Control the window to select the assembly and specific control appears where you also set the DataContext. If you change an existing control (e.g. a TextBox) to Custom Control at the right of the screen, where the control's properties are, you can see something like this.

单击更改..."超链接按钮,然后选择您的类库和自定义控件.这就是全部.

You click the Change... hyperlink button and you select your class library and custom control. That's all there is to it.

我希望这对您有帮助

 

 


这篇关于用户控制问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-18 09:47