I have Control Library and WPF application. I need to create my custom control to vizualize graph. So I made GraphControl and set there custom attribute GraphData:
public static readonly DependencyProperty GraphDataProperty = DependencyProperty.Register("GraphData", typeof(Graph), typeof(GraphControl)); public Graph GraphData { get { return (Graph)GetValue(GraphDataProperty); } set { SetValue(GraphDataProperty, value); TextBlock.Text = "asdfasdfasdfasdfasd"; } } This part is done,but but now I want to bind GraphData to property in MainWindow of application where GraphControl is nested. I mean I want to change some graphData property in MainWindow and when I do that, graph rerenders, and all rendering occurs inside control, not window. Ex:
<controls:GraphControl x:Name="GraphControl" GraphData="{Binding GraphData}"/> If I create new DependencyProperty in Window, then all changes are handled in window, not control.