English 中文(简体)
我如何使用卡利伯。 • 制定《顿》案文及其行动的微小公约?
原标题:How can I use Caliburn.Micro conventions to set a button s text and its action?

如果我的看法中有一个叫作“S Save”,那么我可以把“拯救财产”添入我的观点Model和Caliburn。 微额信贷将自动与我顿的内容挂钩。 例如:

public string Save { get { return StringResources.Save; } }

或者,我可以把“拯救”方法添加到我的视野和卡利伯。 当纽芬兰被点击时,微额信贷将采用这种方法。 例如:

public void Save() {
    Document.Save();
}

但是,如果我想要做两件事,什么呢? C# don t 让我宣布一种方法和一种名称相同的财产。 我能否利用公约 > 订立纽伦的内容以及在点击时采取行动?

(我知道,我可以人工对彼此具有约束力,但如果实际可行,我可以使用公约。)

这是一项共同的需要,因此,你认为,这将建设到卡利伯。 微额信贷似乎并不重要。 我看到了一些法典,将公约扩大到支持这一点(如果情况不好,我就把它作为答案),但它与一些奇迹qui合——因此,我要听到,是否有任何其他人使这项工作更加干净。

Note: I did see this similar question, but it seems to be about whether this is a good idea or not; I m asking about the mechanics. (I ll reserve judgment on whether it s a good idea until I ve seen the mechanics. (grin))

问题回答

速效项目

<Button x:Name="Save"><TextBlock x:Name="SaveText"></TextBlock></Button>




相关问题
Caliburn element convention

While trying to learn the source for GameLibrary sample application I saw a line like this: ConventionManager.AddElementConvention<Rating>(Rating.ValueProperty, "Value", "ValueChanged"); ...

How can I bind key gestures in Caliburn.Micro?

How can I get Caliburn.Micro to map a key gesture to an action method on my ViewModel? For example, I want to implement a tabbed interface, and I want my ShellViewModel to have a NewTab method, which ...

Caliburn.Micro & Telerik WPF Controls

Hope you re all well. I am using Caliburn.Micro with Telerik s WPF controls to build a tabbed interface. Using RadTabControl I have the following code; <telerik:RadTabControl x:Name="Items" Grid....

WPF DataGrid: handling CanUserAddRows=true cleanly with MVVM

I ve been looking into MVVM lately, and after I discovered Caliburn.Micro things have been pretty swell; I m still in the early learning stages, but I belive I have an OK feel for the MVVM basics. I ...

Caliburn.Micro and WebServiceResult

I m looking for the correct version of this class for Caliburn.Micro public class WebServiceResult : IResult where T : new() The above signature is from the ContactManager example in the full ...

Silverlight, Caliburn, Actions and DataGrids

Anyone know of good code examples of the Caliburn or Caliburn Micro framework example that illustrate routing Actions with DataGrid items?