Silverlight Close/Cancel button
Posted
by Fizz
on Stack Overflow
See other posts from Stack Overflow
or by Fizz
Published on 2010-06-07T13:10:18Z
Indexed on
2010/06/07
13:12 UTC
Read the original article
Hit count: 270
silverlight-4.0
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
IsDirty = false - Content is "Close"
IsDirty = true - Content is "Cancel"
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
© Stack Overflow or respective owner