Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Problem with binding. (Read 2354 times)
PDM.
Senior Member
****
Offline


I love YaBB 1G - SP1!

Posts: 256
Joined: Dec 2nd, 2010
Problem with binding.
Jul 1st, 2011 at 9:25am
Print Post  
Code
Select All
Hello, Sotyo i continue working on a few Usercontrols.
This problem is not related to Mindfusion component but hope stoyo or any one can helpme,


<Border x:Name="square"
Background="Black"
BorderThickness="4"
CornerRadius="8"
Margin="-3,-3,-3,0"
BorderBrush="White"
Height="50" VerticalAlignment="Top" >
<Border.RenderTransform>
<TranslateTransform x:Name="squareTranslate"  Y="{Binding ThisValue}" />
</Border.RenderTransform>
</Border>


static public DependencyProperty ThisValueProperty = DependencyProperty.Register("ThisValue", typeof(double), typeof(mycomponent5));
public double ThisValue

  {
  get { return (double)GetValue(ThisValueProperty); }
  set { SetValue(ThisValueProperty, value); }
  }


How should bind?
This way not work.
Sotyo can showme how can solve this?
 


  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Problem with binding.
Reply #1 - Jul 1st, 2011 at 9:58am
Print Post  
Hi Pablo,

Is this Xaml from a control template? In such case try using TemplateBinding instead of Binding.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
PDM.
Senior Member
****
Offline


I love YaBB 1G - SP1!

Posts: 256
Joined: Dec 2nd, 2010
Re: Problem with binding.
Reply #2 - Jul 1st, 2011 at 10:04am
Print Post  
Hello Stoyo!
No is controltemplate : (
im broken my head for make this work! lol
Shocked
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Problem with binding.
Reply #3 - Jul 1st, 2011 at 11:19am
Print Post  
For Binding to work, the object that contains ThisValue must be set as a DataContext of the object described by the Xaml above. Have you done that? If ThisValue is a member of the same UserControl, add the following to the control's constructor:

this.DataContext = this;

I think it's expected to use ControlBinding and ControlTemplates in such scenarios though.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint