I am currently attaching a list to a list of objects, and each of them works.
I can snap to my code behind xaml while I put in my Window element DataContext="{Binding RelativeSource={RelativeSource Self}}"
My ListView looks like this, and bindings work correctly for my bound columns on the properties of MyCollection elements.
<ListView ItemsSource="{Binding MyCollection}">
For one of the columns, although I always want him to say the same thing. For example, this column will always contain "Hello World"
The following code gives me an error for binding:
<GridViewColumn Header="I want all fields to be Hello World" DisplayMemberBinding="{Binding Source={x:Static Member=MyNamespace.MyStaticClass},Path=MyStaticStringField}" />
I get an error message:
error MC3050: Cannot find type "MyNamespace". Note that type names are case sensitive.
MyNamespace is the same namespace as the window itself, and MyStaticClass is public
If I try instead:
<GridViewColumn Header="I want all fields to be Hello World" DisplayMemberBinding="{Binding Source={x:Static Member=MyStaticClass},Path=MyStaticStringField}" />
I get an error message:
MC3029: MyStaticClass , .
, , :
<GridViewColumn Header="This works" DisplayMemberBinding="{Binding Source={x:Static Member=SystemFonts.IconFontFamily}, Path=Source}" />
, :
namespace MyNamespace
{
public static class MyStaticClass
{
public static string MyStaticStringField{ get; set; }
}
}