I am trying to share an ObjectDataProvider resource between my main application and user control. I define odp in a separate resource dictionary file that is included in the application and user control.
<ObjectDataProvider x:Key="AsymmetricFrameHolder" ObjectType="{x:Type data:DataFrameAsymmetric}"/>
Then I will try to access this in the main application as follows:
ObjectDataProvider odp = (ObjectDataProvider)Resources["AsymmetricFrameHolder"]; return (DataFrameAsymmetric)odp.ObjectInstance;
And bind 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 application and one in the user control.
How to configure the program so that one common instance is created?
source share