Your binding should look something like this: Button Command="{Binding Path=DataContext. MyCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type TypeOfYourControlWithViewModelDataContext}}.
Your binding should look something like this.
Thanks, I'll give it a try. I should just start experimenting with stuff, but I always get completely lost when trying to figure out how everything is connected, and what's a logical approach to setting Ancestors. – Dave Dec 6 '10 at 18:03 Hmm... no luck yet.
I get this error: System.Windows. Data Error: 4 : Cannot find source for binding with reference 'RelativeSource FindAncestor, AncestorType='Company. MyPlugin', AncestorLevel='1''.
BindingExpression:Path=DataContext. MyCommand; DataItem=null; target element is 'Button' (Name=''); target property is 'Command' (type 'ICommand'). – Dave Dec 6 '10 at 18:15 It looks like you still don't have the datacontext right.
You need to set the relative source type to whatever will have the datacontext of the viewmodel. Also, you seem like you could get this automatically if you were not overriding the datacontext of your Grid to the the control, rather you could just allow the datacontext to naturally flow down from the parent. – poindexter12 Dec 6 '10 at 18:52 @poindexter: will not specifying the DataContext in the Grid allow my other UserControl (within this UserControl) to databind properly?
I'll give it a try though. – Dave Dec 6 '10 at 19:12 @poindexter: interesting, so just removing the DataContext completely made everything work properly. I am very confused by this.
I'll need to read more on the "flow" for databinding, but if you can post up any of your favorite articles, I'll gladly read them. :) Thanks for your advice. – Dave Dec 6 '10 at 19:18.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.