开发者

Click Event of a button to fire defined inside a listbox item placed at resources.xaml

I have created a style for a listbox item which shows up the button. I can't fire the click event of a button as the style is kept in resources.xaml. How to fire the click event of a button?

I am setting the command property of a button :

<Button x:Name="image"  Grid.Column="9" Margin="4 0 4 0" Style="{StaticResource LedgerDeleteIcon}" HorizontalAlignment="Right"
                  Command="{Binding DeleteCommand}" CommandParameter="{Binding}" />

and in the usercontrol where i applying this style to a listbox, i am defining a delegate command :

public DelegateCommand DeleteCommand{ get; private set; }

and in constructor of the user control:

   this.DeleteCommand = new DelegateCommand(cli开发者_如何学JAVAck_DeleteBn);


private void click_DeleteBn(object args)
{

}

But it doesn't fire am i doing anytinh wrong ?


Using Silverlight 4 the best way to do this is to bind the Button Command property to an implementation of ICommand.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜