Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > Avalon

Vista - Binding to properties of a user control

 
 
Old 02-17-2008   #1 (permalink)
Dave


 
 

Binding to properties of a user control

Just getting up to speed with WPF...

I've got a simple user control:

<UserControl x:Class="WpfApplication2.MyUserControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Height="300" Width="300">
<Button>Hello, world</Button>
</UserControl>

And I want to apply a transform to this when it is instantiated and
bind the animation to the transform:

<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="WpfApplication2.Window1"
Title="Window1" xmlns:d="http://schemas.microsoft.com/expression/
blend/2006"
xmlns:my="clr-namespace:WpfApplication2">

<StackPanel>
<my:MyUserControl>
<my:MyUserControl.RenderTransform>
<TranslateTransform x:Name="MyTransform" X="10"/>
</my:MyUserControl.RenderTransform>

<my:MyUserControl.Triggers>
<EventTrigger RoutedEvent="Button.Click" >
<BeginStoryboard>
<Storyboard>
<DoubleAnimation
Storyboard.TargetName="MyTransform" Storyboard.TargetProperty="X"
IsCumulative="True" By="100"></DoubleAnimation>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</my:MyUserControl.Triggers>

</my:MyUserControl>
</StackPanel>
</Window>

Doesn't compile.

error MC3093: Cannot set Name attribute value 'MyTransform' on element
'TranslateTransform'. 'TranslateTransform' is under the scope of
element 'MyUserControl', which already had a name registered when it
was defined in another scope. Line 11 Position 37.

Any ideas?

My System SpecsSystem Spec
Old 04-10-2008   #2 (permalink)
Alexey Yakovlev


 
 

RE: Binding to properties of a user control

Hi Dave!
Did you find any workaround for this?


My System SpecsSystem Spec
 

Thread Tools



Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46