Question

Say I have:

<TextBlock Text="{Binding MyString}"/>

public class AlanViewModel {
  public string MyString {get; set;}
  public TextBlock Control { get; set; } //How to bind this to the TextBlock control?
}

Can I bind the instance of the control to the ViewModel, or must I continue to jump through hoops in the code-behind to couple them together?

I know this couples the ViewModel to the View, but it's for a good reason.

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top