![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| 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. |
| |||||||
| |
| | #1 (permalink) |
| | 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 Specs![]() |
| | #2 (permalink) |
| | RE: Binding to properties of a user control Hi Dave! Did you find any workaround for this? |
My System Specs![]() |
| Thread Tools | |
| |