locked
Subject: Button template databind (tomha) - 10/23/2006 7:09 AM PST RRS feed

  • Question

  • By: tomha

    Hi,
    I have made a button template which uses a ContentPresenter to display the
    button text (the Content-property). So far so good.

    I am having problems adding icons to the buttons. I want different icons for
    the different buttons, but I don't want a separate template for each button.

    I added an Image to the template, and I guess I somehow have to databind its
    Source-property, but I don't know how. I can't specify the file path in the
    template for example, since all buttons then get the same icon...

    How can I do this databind? Where should I specify which icon belongs to
    which button?
    Tuesday, February 19, 2008 6:08 PM

Answers

  • By: Unni Ravindranathan (MS)

    Hi Tomas,

    We have a nice tutorial around this scenario -
    http://blogs.msdn.com/expression/articles/525441.aspx

    Hope this helps!
    -Unni

    "tomha" <tomha@discussions.microsoft.com> wrote in message
    news:2D62F8F6-A8E1-4C25-BA11-A03B8F950F79@microsoft.com...
    > Hi,
    > I have made a button template which uses a ContentPresenter to display the
    > button text (the Content-property). So far so good.
    >
    > I am having problems adding icons to the buttons. I want different icons
    > for
    > the different buttons, but I don't want a separate template for each
    > button.
    >
    > I added an Image to the template, and I guess I somehow have to databind
    > its
    > Source-property, but I don't know how. I can't specify the file path in
    > the
    > template for example, since all buttons then get the same icon...
    >
    > How can I do this databind? Where should I specify which icon belongs to
    > which button?
    >
    > Thanks,
    > Tomas Hansson
    >
    >
    Tuesday, February 19, 2008 10:00 PM

All replies

  • By: Unni Ravindranathan (MS)

    Hi Tomas,

    We have a nice tutorial around this scenario -
    http://blogs.msdn.com/expression/articles/525441.aspx

    Hope this helps!
    -Unni

    "tomha" <tomha@discussions.microsoft.com> wrote in message
    news:2D62F8F6-A8E1-4C25-BA11-A03B8F950F79@microsoft.com...
    > Hi,
    > I have made a button template which uses a ContentPresenter to display the
    > button text (the Content-property). So far so good.
    >
    > I am having problems adding icons to the buttons. I want different icons
    > for
    > the different buttons, but I don't want a separate template for each
    > button.
    >
    > I added an Image to the template, and I guess I somehow have to databind
    > its
    > Source-property, but I don't know how. I can't specify the file path in
    > the
    > template for example, since all buttons then get the same icon...
    >
    > How can I do this databind? Where should I specify which icon belongs to
    > which button?
    >
    > Thanks,
    > Tomas Hansson
    >
    >
    Tuesday, February 19, 2008 10:00 PM
  • By: tomha

    Thanks for the tip! :)
    
    "Unni Ravindranathan (MS)" wrote:
    
    > Hi Tomas,
    > 
    > We have a nice tutorial around this scenario - 
    > http://blogs.msdn.com/expression/articles/525441.aspx
    > 
    > Hope this helps!
    > -Unni
    > 
    > "tomha" <tomha@discussions.microsoft.com> wrote in message 
    > news:2D62F8F6-A8E1-4C25-BA11-A03B8F950F79@microsoft.com...
    > > Hi,
    > > I have made a button template which uses a ContentPresenter to display the
    > > button text (the Content-property). So far so good.
    > >
    > > I am having problems adding icons to the buttons. I want different icons 
    > > for
    > > the different buttons, but I don't want a separate template for each 
    > > button.
    > >
    > > I added an Image to the template, and I guess I somehow have to databind 
    > > its
    > > Source-property, but I don't know how. I can't specify the file path in 
    > > the
    > > template for example, since all buttons then get the same icon...
    > >
    > > How can I do this databind? Where should I specify which icon belongs to
    > > which button?
    > >
    > > Thanks,
    > > Tomas Hansson
    > >
    > > 
    > 
    > 
    > 
    Tuesday, February 19, 2008 10:01 PM