Made a much simpler example, hopefully someone can follow this and help me
Here is my code.
ViewModel
public class ViewModel
{
private Person _noninterfacePerson;
private IPerson _interfacePerson;
public ViewModel()
{
_noninterfacePerson = new Person();
_interfacePerson = new Person();
}
public Person NonInterfacePerson
{
get { return _noninterfacePerson; }
}
public IPerson InterfacePerson
{
get { return InterfacePerson; }
}
}
Person
public class Person : IPerson
{
public Person()
{
}
public string Name
{
get;
set;
}
public int age
{
get;
set;
}
}
IPerson
public interface IPerson
{
int age { get; set; }
string Name { get; set; }
}
View
<Window x:Class="WpfApplication2.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WpfApplication2"
mc:Ignorable="d"
Title="MainWindow" Height="350" Width="525">
<Grid d:DataContext="{d:DesignInstance local:ViewModel}">
</Grid>
</Window>
In Expression Blend if I insert a textblock, click on the "Advanced Options" -> Data Binding... -> Data Context I see both InterfacePerson and NonInterfacePerson as options to bind to. However, NonInterfacePerson has a little arrow showing the other properties I can bind to. Age and Name in this case.
The same thing happens when I set d:DataContext to a d:DesignData Source. I didn't use that for this example because it is more complicated. But that is where I really want this to work because then I can see all my binding options AND have sample data.
If I instead do this in my view:
<Window x:Class="WpfApplication2.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WpfApplication2"
mc:Ignorable="d"
Title="MainWindow" Height="350" Width="525">
<Window.Resources>
<local:ViewModel x:Key="DummyVM"/>
</Window.Resources>
<Grid d:DataContext="{Binding Source={StaticResource DummyVM}}">
</Grid>
</Window>
Then I CAN see the properties of InterfacePerson, however, I still cant get the easy implementation of sample data that I would like using d:DesignData.
It should be noted that in all cases, if I manually type in the path it works fine. This is purely a matter of getting Blend to show them so it is easier to set up the bindings.
Thanks for any help you can provide on this!