开发者

Silverlight Close/Cancel button

This is for Silverlight 4, I want to create a new button class for a close/cancel button to use on dataentry screens. The aim is to move the "confirm cancel" interaction to the control rather than having it in the ViewModel. Functional outline:

1) Have a property IsDirty, needs to support binding

2) Has two "states", controled by IsDirty

3) When clicked if it is Dirty show a message box to confirm cancel, before calling the command

4) Both states will call the command

Usage would be

<i:CancelButton Command="{Binding Path=CloseCommand}" IsDirty="{Binding Path=IsDirty}"/>

I am looking for pointers, I think a Templated Control would be the best option, but need some guidance on how to do this


I would seriously think of using a behaviour for this sort of functionality, that way you keep a seperation between the functionality and how it is displayed. Also you can then add the behaviour to other uiitems besides button.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜