Skip to main content
Home Forums Silverlight Programming Programming with .NET - General databind to an attched property
3 replies. Latest Post by Amanda Wang - MSFT on June 8, 2009.
(0)
davesmits
Member
624 points
198 Posts
06-02-2009 10:01 AM |
how can i databind to an attched property in xaml? when using {binding something} it only looks to his datacontext
jay nana...
Contributor
3388 points
624 Posts
06-02-2009 10:24 AM |
Read this thread:
http://silverlight.net/forums/t/21814.aspx
06-02-2009 10:51 AM |
Thank you for you reply but unfortunaly i think it not my problem;
Ik have a custom user control; and in that user control i made an attached property.
{
}
in the same user control i want to databind to this property
Amanda W...
All-Star
17241 points
1,466 Posts
06-08-2009 3:52 AM |
Hi davesmits ,
Below is a sample code to implement to make the button's content proeprty bind to the attached property, it works fine in our labs.
1. The xaml code of the button:
<Button x:Name="bouton" Content="{Binding}" Click="bouton_Click"></Button>
2. the codebehind(the btn is a publicj in the SilverlightControl2 ):
SilverlightControl2 ctl = new SilverlightControl2();this.bouton.DataContext = ctl.btn;