I am trying to share an ObjectDataProvider resource between my main application and a user control. I define the odp in a separate resource dictionary file that is included in the app and the user control.
<ObjectDataProvider x:Key="AsymmetricFrameHolder" ObjectType="{x:Type data:DataFrameAsymmetric}"/>
I then try to access this in the main app as follows
ObjectDataProvider odp = (ObjectDataProvider)Resources["AsymmetricFrameHolder"];
return (DataFrameAsymmetric)odp.ObjectInstance;
and bind to it in the user control with
<Grid Name="grid" Height="Auto" Width="Auto" DataContext="{StaticResource AsymmetricFrameHolder}">
then
<TextBox Name="TextBox_Length" Grid.Row="0" Grid.Column="1" Text="{Binding Path=Length }"/>
This creates 2 instances of DataFrameAsymmetric. One in the main app and one in the user control. How can I set the program so that a single shared instance is created?