我有一些在代码后实例化的对象,例如,XAML称为window.xaml,并且在window.xaml.cs中
protected Dictionary<string, myClass> myDictionary;如何仅使用XAML标记将此对象绑定到例如列表视图?
更新:
(这正是我的测试代码中包含的内容):
<Window x:Class="QuizBee.Host.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="{Binding windowname}" Height="300" Width="300"
    DataContext="{Binding RelativeSource={RelativeSource Self}}">
    <Grid>
    </Grid>
</Window>并在代码背后
public partial class Window1 : Window
{
    public const string windowname = "ABCDEFG";
    public Window1()
    {
        InitializeComponent();
    }
}假设标题应该变成“ ABCDEFG”,对吗?但最终什么也没显示。