Sounds like what you want is to create the object in your viewmodel, expose it as a property, and bind it to the Content
property of your zoom control, something like this:
viewmodel:
public class ViewModel {
private EntityGraphLayout _layout = new EntityGraphLayout();
public EntityGraphLayout EntityGraphLayoutProperty
{
get { return _layout; }
set { _layout = value; }
}
}
XAML:
<zoom:ZoomControl Content="{Binding EntityGraphLayoutProperty}" Grid.Row="1" Zoom="0.2" ZoomBoxOpacity="0.5" Background="#ff656565" >
</zoom:ZoomControl>
Note that you will need to make sure the DataContext
for the zoom control is set to your viewmodel.
If you want it created in XAML, you could also access the object in your viewmodel by referring to it by the graphLayout
name you defined in the XAML. This would require a reference to the view in your viewmodel, which may not be ideal.