Reputation: 5477
I have the following method in my View;
Label GetSummaryLabel(Panel panel, ServiceChargeType type)
{
var chargeTextbox = panel.Children[1];
var summarybinding = new Binding { Source = chargeTextbox, Path = new PropertyPath("Text") };
var summaryLabel = new Label();
summaryLabel.SetBinding(ContentProperty, summarybinding);
return summaryLabel;
}
This works fine, but I want to move this function to a helper class, when I do so I get the following compile error;
"Cannot resolve symbol 'ContentProperty'
Why?
Upvotes: 0
Views: 42
Reputation: 4159
ContentProperty is a static
member on ContentControl class. When you are in your view (i.e. UserControl or Window), you are already in one of the derived classes from ContentControl
and the ContentProperty
is available. However, when you move your code to a helper, you need to classify the ContentProperty
with it's class name.
HTH
Upvotes: 1