-
May 19th, 2010, 03:28 AM
#1
this is so strange with ICommand
I have an implementation class of ICommand as follow:
namespace WpfApplication1
{
public class commandBtn
{
private void DoSomething()
{
}
private ICommand _cmd;
public ICommand Cmd
{
get{
_cmd = new GenericCommand(DoSomething);
return _cmd;
}
}
}
}
and my window class as follow:
<Window x:Class="WpfApplication1.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window1" Height="300" Width="300">
<Grid>
<Button Name="test" Content="click" />
</Grid>
</Window>
public Window1()
{
InitializeComponent();
commandBtn ctx = new commandBtn();
this.DataContext = ctx;
}
How come the "Cmd" ICommand is still executed while there is no control that binds to it?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|