I'm using Caliburn.Micro's excellent convention-based binding to bind a button to a method on my view model. Thing is, I want the Content
of the button to be bound to a string
property of the view model.
At the moment I'm allowing the convention binding for the method, and an explicit binding for the content. Here's an example:
E.g.:
<Button x:Name="Submit" Content="{Binding SubmitCaption}" />
public class MyViewModel : PropertyChangedBase
{
public void Submit() {}
public string SubmitCaption { get; set; } // Technically would raise PropertyChanged event
}
However I was wondering if there's there a more elegant way of doing this? I'm thinking about overriding the convention for buttons so that it still binds the button action to a method but the content to a named-by-convention property.
<Button x:Name="Submit" />
public class MyViewModel : PropertyChangedBase
{
public void Submit() {}
public string SubmitContent { get; set; } // Technically would raise PropertyChanged event
}