简体   繁体   English

LightSwitch:如何在AddAndEditNew默认模式中访问和更改控件属性

[英]LightSwitch: how to access and change control properties in AddAndEditNew default modal

In LightSwitch, when I open the default modal, calling the AddAndEditNew_Execute method, I want to change properties of the controls inside the modal dialog. 在LightSwitch中,当我打开默认模态,调用AddAndEditNew_Execute方法时,我想更改模态对话框中控件的属性。

For instance: I want to change a TextBox to "Multiline" or change AutoComplete FilterMode to "Contains". 例如:我想将TextBox更改为“Multiline”或将AutoComplete FilterMode更改为“Contains”。

How can I access to those controls in execution time? 如何在执行时间内访问这些控件?

I know I can add a custom modal, but I just want to change a small thing of it and I don't want to create a whole modal dialog just for this. 我知道我可以添加一个自定义模态,但我只想更改它的一小部分,我不想为此创建一个完整的模态对话框。

I'm always talking about Silverlight client. 我一直在谈论Silverlight客户端。

Thanks in advance. 提前致谢。

I'm afraid that the only way you can do what you want is: 我担心你能做到你想要的唯一方法是:

  • with a custom modal window (if you want the window to be modal) 使用自定义模态窗口 (如果您希望窗口是模态的)
  • or a separate screen (if you don't need the window to be modal) 单独的屏幕 (如果您不需要窗口是模态的)

The properties of a default modal window can't be changed. 无法更改默认模态窗口的属性。 There are no mechanisms to change the properties of any of the controls. 没有机制可以更改任何控件的属性。

The only thing that you can do is to influence which properties get displayed in the default modal window, by checking/unchecking the Display By Default check-box in the table designer. 您可以做的唯一事情是通过选中/取消选中表设计器中的“ 默认显示”复选框来影响在默认模式窗口中显示哪些属性。

But as soon as you need to make changes to either the layout of the controls, or changing any control's properties, you need to create a custom modal window , or separate screen , & display then by calling them in custom code. 但是,只要您需要更改控件的布局或更改任何控件的属性,您需要创建自定义模式窗口单独的屏幕 ,然后通过在自定义代码中调用它们来显示。

The reason for this is because the controls for the default modal window are generated by the LightSwitch run-time. 原因是因为默认模态窗口的控件是由LightSwitch运行时生成的。

It's really just a matter of a balance between not having to do the work to create the window , & flexibility . 这实际上只是在不必进行创建窗口的工作灵活性之间取得平衡。

Default: Easy = Yes, Flexible = No 默认值: Easy = Yes,Flexible = No
Custom: Easy = No, Flexible = Yes 自定义: Easy = No,Flexible = Yes

I know it's not what you wanted to hear, but hopefully my explanation helps you to understand why you can't do it the way you first wanted to. 我知道这不是你想听到的,但希望我的解释可以帮助你理解为什么你不能按照你想要的方式去做。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM