开发者

WPF, C#, binding data, AvalonDock

开发者 https://www.devze.com 2023-03-29 00:02 出处:网络
So I\'m totally new to C#. I\'ve done some Objective-C/iPhone programming. I\'m looking through code and we have this:

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).


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消