Custom Silverlight button with <Path> content and visual states
        Posted  
        
            by Klay
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Klay
        
        
        
        Published on 2010-03-26T18:35:35Z
        Indexed on 
            2010/03/29
            21:03 UTC
        
        
        Read the original article
        Hit count: 485
        
I would like to create a button control that has a Path element as its content--an IconButton if you will.
This button should fulfill two conditions:
1. The Path element's stroke and fill colors should be available for manipulation by the VisualStateManager.
2. The Path element's data string (which defines it's shape) can be set in code or in XAML, so that I can create several such buttons without creating a new custom control for each.
The only way I can see to do it would involve no XAML whatsoever. That is, setting all the visual states and animations in the code behind, plus generating the Geometry objects point by point (and not being able to use the convenient Data string property on the Path element).
Is there a simpler way to do this?
© Stack Overflow or respective owner