WPF、C#、绑定数据、AvalonDock
所以我对 C# 完全陌生。我已经完成了一些 Objective-C/iPhone 编程。我正在查看代码,我们得到了这个:
DocumentPaneLeft.Items.Add(new DocumentContent
{
Name = "sampleDockableContent",
Title = "Samples",
Content = new SampleView { DataContext = this.ParentForm }
});
作为我们用于视图的 AvalonDock 的一部分。所以现在高层不喜欢 AvalonDock 并希望用其他视图替换它,本质上是摆脱layoutManger。我看到在上面的代码中,正在创建一个新的 SampleView,并以某种方式获取显示在视图中的数据。如果我更改 XAML 以在某种网格中显示视图,我如何获取这些数据?
(抱歉,这个问题有些不明确。我只是在了解代码中发生的情况)。
So I'm totally new to C#. I've done some Objective-C/iPhone programming. I'm looking through code and we have this:
DocumentPaneLeft.Items.Add(new DocumentContent
{
Name = "sampleDockableContent",
Title = "Samples",
Content = new SampleView { DataContext = this.ParentForm }
});
as part of the AvalonDock we are using for the view. So now the higher ups don't like the AvalonDock and want it replaced with these other views, essentially getting rid of the layoutManger. I see that in the code above, a new SampleView is being created, and somehow getting the data for it that shows up in the view. If I change the XAML to show the view in a Grid of some sort, how do I get this data?
(Sorry for the somewhat not explicit question. I'm kind of just learning what is happening in the code).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不确定你在这里问什么。
在 xaml 中获取数据通常是通过绑定完成的。 ="{绑定...}"
http://msdn.microsoft.com/en-us/library/ms752347.aspx
DataContext 是绑定可以找到数据的地方。
这意味着您可以在 DataContext (this.parentform) 上放置一个 List 对象,并通过绑定从那里获取数据。
I'm not sure what you are asking here.
Getting data in xaml is normally done with bindings. ="{Binding ...}"
http://msdn.microsoft.com/en-us/library/ms752347.aspx
DataContext is where the binding can find the data.
This means you can place for example a List object on your DataContext (this.parentform) and get the data from there with bindings.