I have a simple question. Of course it has many answers but I cannot choose right keywords to google. How I can bind a subclass to my wpf control?
For example: It s my class.
public class SiteFieldInfo<T>
{
public string Name { get; set; }
public T Value { get; set; }
public List<string> PositiveXPathExpressions { get; set; }
public List<string> NegativeXPathExpressions { get; set; }
}
public class SiteInfo
{
public SiteFieldInfo<string> Author { get; set; }
public SiteFieldInfo<DateTime> Date { get; set; }
public SiteFieldInfo<string> Source { get; set; }
}
而且,我想将现场信息系统的财产价值与文本Box控制的财产相挂钩。
C# Code:
stackPanel1.DataContext = SiteInfoInstance;
xaml Code:
<StackPanel Name="stackPanel1">
<TextBlock Text="Author" />
<TextBox Text="{Binding Path=Author.Value}" />
</StackPanel>
它不工作。 什么是正确的合成物,或者什么替代物?
Sorry, 它的工作良好。 我只是 st。 如何结束问题?