Hey Carl,

As I've been working in the Silverlight space for a while, I prefer the
visual states over triggers. Its nicer experience in Blend (State tab,
rather than Trigger tab, seems a lot easier to figure out whats going on -
For triggers I go straight to the XAML).

If you want to know what States you can use, you can drill into the class (I
picked a button, using Resharper to go into Button, then Buttonbase which
then lead me to a method on Butotnbase called ChangeVisualState. There seems
to be some logic (think thats the magic you're looking for) there for
hooking up button states to visualstates. I followed the visualstates there
to a class called VisualStates (System.Windows.Controls.VisualStates) which
would be a good place to look for all of the magic "wire it up with that
name and it just works" states you could use.
I'm sure each control would differ slightly so it might be a case of dig out
your favourite decompiler and look for yourself (am assuming the
documentation wasn't helpful? bwhahahahahah)

As Shane said if the control is your own custom control then all the magic
is up to you.

On Wed, Oct 12, 2011 at 9:17 AM, <[email protected]> wrote:

>
> Hi all,
>
> Has anyone used States on WPF controls in anger?  I can’t find any info on
> how to use them effectively.
>
> In my brief foray into them, I added a Button to a window, edited its
> template, switched to the States tab in Blend and it’s got some recommended
> states prepopulated.  Modifying the template and recording into those
> states gives the effect I want.  So far so good.
>
> If I go to the states pane on a custom built control it has recommended
> states, but not the ones I want (the common states, like mouse over etc).
> I try copying the state manager section from the previously styled button,
> but these states are missing the magic that binds(?) them up correctly and
> don’t work as expected.
>
> There’s a bit of magic here I don’t quite understand.  Can I manually hook
> up the common states?  Where does the magic happen?
>
> And finally, is it worth the effort?  I’m worried I’ll remove my working
> triggers to use states, and get to a point where the states fail and I’ll
> have to roll back to using triggers.  Any advice?
>
> Cheers,
> Carl.
>
> Carl Scarlett
> Senior .NET/WPF Developer, UX Designer | Genesis
> IT & Change Management | Bankwest
> A: Level 5, 199 Hay Street | Perth | Western Australia | 6004
> P: (08) 9449 8451
> M: 0408 913 870
> E: [email protected]
>
> (Embedded image moved to file: pic13385.jpg)
>
>
> _______________________________________________________________________________
> Unencrypted electronic mail is not secure and may not be authentic.
> If you have any doubts as to the contents please telephone to confirm.
>
> This electronic transmission including any attachments is intended only
> for those to whom it is addressed. It may contain copyright material or
> information that is confidential, privileged or exempt from disclosure by
> law.
> Any claim to privilege is not waived or lost by reason of mistaken
> transmission
> of this information. If you are not the intended recipient you must not
> distribute or copy this transmission and should please notify the sender.
> Your costs for doing this will be reimbursed by the sender.
>
> We do not accept liability in connection with computer virus, data
> corruption,
> delay, interruption, unauthorised access or unauthorised amendment.
>
> _______________________________________________________________________________
>
> ______________________________________________________________________
> This email has been scanned by the MessageLabs Email Security System.
> For more information please visit http://www.messagelabs.com/email
> ______________________________________________________________________
>
> _______________________________________________
> ozwpf mailing list
> [email protected]
> http://prdlxvm0001.codify.net/mailman/listinfo/ozwpf
>
>
_______________________________________________
ozwpf mailing list
[email protected]
http://prdlxvm0001.codify.net/mailman/listinfo/ozwpf

Reply via email to