locked
My custom button disappear when I move it on the X or Y axis RRS feed

  • Question

  • Hi there,

    In Expression Blend 3 I have done a button template. I have several buttons and I've applied the template on them. But, when I drag and drop it over the X or Y axis, the template disappear and only the content is visible :S , why?

    Cheers.
    .: Valeriano Tórtola MCTS WPF :.: http://www.vtortola.net :.
    Wednesday, March 10, 2010 11:47 AM

All replies

  • Could you paste the xaml for your template and buttons?
    Wednesday, March 10, 2010 2:00 PM
    Moderator
  • I've uploaded the project to:

    http://cid-7e62f3c3b5775c42.skydrive.live.com/self.aspx/.Public

    http://cid-7e62f3c3b5775c42.skydrive.live.com/self.aspx/.Public/SilverlightApplication1.zip


    Also if you can tell me why the panel in the bottom left has aliased fonts I'll be very gratefull :D

    Cheers.

    .: Valeriano Tórtola MCTS WPF :.: http://www.vtortola.net :.
    Wednesday, March 10, 2010 3:10 PM
  • Any update? :(

    .: Valeriano Tórtola MCTS WPF :.: http://www.vtortola.net :.
    Tuesday, March 23, 2010 2:43 PM
  • Sorry, for some reason the alerts system flaked out for a few days in there, and I missed update notifications.  I'll take a look.
    Tuesday, March 23, 2010 3:38 PM
    Moderator
  • It looks like when you drag it to certain positions, mainly near the center point vertically or horizontally, Blend sets both margins (left/right or top/bottom) and sets the height/width to auto, and sets it to stretch.  Because your button template uses template binding for height/width, it picks up the auto value, and picks 0 as a size for the height or width.  There are several solutions, such as being sure your buttons have a height/width set.  Another more complicated solution would be to change your ellipses to not bind their height/width with template binding, but set them to auto and set them to stretch to fill with appropriate margins if needed.

     

    When I run your project the text "ListBoxItem" appears to be anti-aliased when magnified.  But I am running with it with the SL4 runtime, and I believe many changed have been made in the font rendering.  Could you post screenshots of what you are seeing?  (Zoomed in if possible)

     

     

    Tuesday, March 23, 2010 4:01 PM
    Moderator
  •  

    Thanks! There you go the pictures

     

     

    Cheers!


    .: Valeriano Tórtola MCTS WPF :.: http://www.vtortola.net :.
    Friday, March 26, 2010 3:05 PM
  • It appears that you have a drop shadow on the box containing the text, when you apply an effect, SL can no longer do cleartype rendering, and has to fall back to non clear-type, which is probably what you are seeing.  You might be able to work around that by structuring it as 2 separate components in a grid:

     

    <grid>

    <rect with fill/rounded corners/shadow/>

    <TextBlock with text, transparent />

    </grid>

     

     

     

    Friday, March 26, 2010 6:09 PM
    Moderator