I’ve got a property in a base class (view model), which when used in data binding in XAML doesn’t show up. It does however show up when I move that property to the derived view model. Why?
XAML:
<TextBlock Margin="5,0,0,0" VerticalAlignment="Center"
Text="{Binding Path=ResxMessages.SelectPathToDevice}" />
Code Behind:
public abstract class BaseViewModel{
protected bool ThrowOnInvalidPropertyName { get; set; }
/*Putting this property here doesn't work*/
private static Messages _resxMessages = null;
public static Messages ResxMessages
{
get
{
if (_resxMessages == null)
_resxMessages = new Messages();
return _resxMessages;
}
}
}
public class MainViewModel :BaseViewModel{
protected bool ThrowOnInvalidPropertyName { get; set; }
/*Putting this property here DOES work*/
private static Messages _resxMessages = null;
public static Messages ResxMessages
{
get
{
if (_resxMessages == null)
_resxMessages = new Messages();
return _resxMessages;
}
}
}