![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
br> br> |
| |||||||
![]() |
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| Guest | Binding properties of two elements on a canvas A canvas has two rectangles, one of which can be moved by means of a slider. Is it possible to let the second follow the first by binding to the 'Canvas.Left' of the rectangle? The line <Binding ElementName="rec" Path="Canvas.Left"> seems to be accepted in XAMLPad but does not produce the expected result. <Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" > <Canvas> <StackPanel Orientation="Vertical" > <StackPanel Orientation="Horizontal" > <Slider Margin="5,5,5,5" Name="slider2" DockPanel.Dock="Top" Maximum="1000" Minimum="10" /> <Label Content="{Binding ElementName=slider2, Path=Value}"></Label> </StackPanel> </StackPanel> <Rectangle Width="50" Height="50" Fill="yellow" Canvas.Left="{Binding ElementName=slider2, Path=Value}" Canvas.Bottom="325" Name="rec" /> <Rectangle Width="50" Height="50" Fill="Red" Canvas.Top="120" > <Canvas.Left> <Binding ElementName="rec" Path="Canvas.Left"> <!--- this is allowed but does not work... */ --> </Binding> </Canvas.Left> </Rectangle> </Canvas> </Page> [Thanks] |
My System Specs![]() |
| | #2 (permalink) |
| Guest | RE: Binding properties of two elements on a canvas Instead of Path="Canvas.Left" use Path="(Canvas.Left)" -- Valentin Iliescu [MVP - Client Application Development] "Illumineo" wrote: > A canvas has two rectangles, one of which can be moved by means of a > slider. Is it possible to let the second follow the first by binding to > the 'Canvas.Left' of the rectangle? > > The line > <Binding ElementName="rec" Path="Canvas.Left"> > seems to be accepted in XAMLPad but does not produce the expected > result. > > > > > <Page > xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" > xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" > > > > <Canvas> > <StackPanel Orientation="Vertical" > > > <StackPanel Orientation="Horizontal" > > <Slider Margin="5,5,5,5" Name="slider2" > DockPanel.Dock="Top" Maximum="1000" > Minimum="10" /> > <Label Content="{Binding ElementName=slider2, > Path=Value}"></Label> > </StackPanel> > </StackPanel> > <Rectangle > Width="50" > Height="50" > Fill="yellow" > Canvas.Left="{Binding ElementName=slider2, Path=Value}" > Canvas.Bottom="325" > Name="rec" > /> > > <Rectangle > Width="50" > Height="50" > Fill="Red" > Canvas.Top="120" > > > <Canvas.Left> > <Binding ElementName="rec" Path="Canvas.Left"> <!--- this is allowed > but does not work... */ --> > > </Binding> > </Canvas.Left> > </Rectangle> > </Canvas> > </Page> > > > [Thanks] > > |
My System Specs![]() |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Can't delete elements in folder Recent elements | Gudmund Liebach Nielsen | Vista General | 1 | 05-05-2008 07:17 PM |
| Binding to properties of a user control | Dave | Avalon | 1 | 04-10-2008 08:29 AM |
| Binding inside binding question | Yoavo | Avalon | 0 | 12-03-2007 08:24 AM |
| Binding Question (Binding in General) | Jason | Avalon | 2 | 05-09-2007 04:41 AM |
| Support for Adobe photoshop elements 5 or premier elements 3 on Vista 64 bits | Sébastien DELAYRE | Vista General | 5 | 03-26-2007 09:57 AM |