开发者

Binding Commands Without Using the DataContext [silverlight+prism]

Hello I have a problem with binding commands to button inside datagrid.

Here should be explanation but it doesn't explain everything.

http://msdn.microsof开发者_Python百科t.com/en-us/library/dd458928.aspx

What should be in classes in namespace Infrastructure?

Can somebody show me a really basic sample of using this? not just parts of the code...


The Prism Commanding QuickStart - included with the Prism drop should provide the simple code example you are looking for.

All data-bindings go against the current DataContext unless specified otherwise. The DataContext is inherited down the tree of controls unless a control specifically picks a DataContext.

For example your Button might look like this and would look for the SaveCommand on whatever the DataContext has:

<Button Command="{Binding SaveCommand} />

Your button could also look like this if you wanted to bind to a command exposed on your classes code-behind:

<UserControl x:Name="UserControl">
   ...
    <Button Command="{Binding SaveCommand, ElementName=UserControl}"
   ...
</UserControl>

Using DelegateCommand is just a way of implementing the ICommand you bind to and that should be visibile in the Prism QuickStart.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜