Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

Multiple targets for a single poco

$
0
0

I want to bind multiple ContentControls to a single property. The property is of type canvas, it won't work because a canvas can only be a child of ONE control:

private Canvas mycanvas;
public Canvas Mycanvas
{
    get
    {
       return mycanvas;
     }

     set
     {
        if (mycanvas == value) return;
         mycanvas = value;
         OnPropertyChanged("Mycanvas");
     }
}

if you have:

<ContentControl x:Name="ControlSmall" Content="{Binding MyCanvas}" ... />

<ContentControl x:Name="ControlLarge" Content="{Binding MyCanvas}" ... />

only the second control works. I'm assuming that's because a FrameworkElement can't be the child of two separate elements.

My question:

Is there any way to get a "view" from a canvas? Something like: MyCanvas.GetView() that can be bound to multiple targets?

OR... do I need to go through all the children of the canvas, and create copies of the items (Paths) and build a new canvas?Thank

Thank You!



Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>