tags:

views:

40

answers:

2

Hi,

I try to bind a translateTransform and a compositeTransform together in silverlight 4 in the code (c#). I can't do this in xaml because the UIelements are loaded dynamically. I just need the Xoffset. The compositeTransform is the source. I have the flowing code, but it doesn't work:

TranslateTransform trans = new TranslateTransform();
Binding transBind = new Binding("Value");
transBind.Source = ((CompositeTransform)SchedulePanel.RenderTransform);
BindingOperations.SetBinding(trans, TranslateTransform.XProperty, transBind);
line.TextChannelName.RenderTransform = trans;

Thanks

A: 

Looks to me as though:-

Binding transBind = new Binding("Value"); 

should be

Binding transBind = new Binding("TranslateX");

a composite transform does not have a "Value" property.

AnthonyWJones
A: 

Thanks for your fast reply. I did change the Value in TranslateX, but now i get an ArgumentException at:

BindingOperations.SetBinding(trans, TranslateTransform.XProperty, transBind);

The exception is:

Target must be a FrameworkElement or a CollectionViewSource.

Dusty