I have following excerpt of a XAML in a C# WPF application and it is working fine:
<usercontrols:Own_Object Panel.ZIndex="5" Height="100" Width="77.5"
Own_ObjectClickedCommand="{Binding ControlClickedCommand}"
Level="1"
Own_ObjectDto="{Binding Own_Objects, ConverterParameter=..., Converter={...}}"
Now I would like to set the Canvas.Left
and Canvas.Top
properties, based on some properties of the Own_ObjectDto
object. I tried as follows:
<usercontrols:Own_Object Panel.ZIndex="5" Height="100" Width="77.5"
Canvas.Left="{Binding Path=Own_ObjectDto.PosX, diag:PresentationTraceSources.TraceLevel=High}"
Canvas.Top="{Binding Path=Own_ObjectDto.PosY, diag:PresentationTraceSources.TraceLevel=High}"
Own_ObjectClickedCommand="{Binding ControlClickedCommand}"
Level="1"
Own_ObjectDto="{Binding Own_Objects, ConverterParameter=..., Converter={...}}"
This is not working as Own_ObjectDto
is not part of the viewmodel.
I don't want to include Own_ObjectDto
into the viewmodel. I just want to use Own_ObjectDto
as a source of some information.
Apparently I can't do that, using the {Binding ...}
command.
How can I do this?
I also tried this, but it did not work either:
Canvas.Left="ShuttleDto.PosX"