Skip to main content
AI Assist is now on Stack Overflow. Start a chat to get instant answers from across the network. Sign up to save and share your chats.
edits in the form
Source Link
gnclmorais
  • 5k
  • 5
  • 32
  • 42

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.

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 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.

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 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.

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"; } } 

Okay thisThis part is done, but... Nowbut 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.

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"; } } 

Okay this part is done, 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.

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 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.

Source Link

WPF bindings in window and user control

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"; } } 

Okay this part is done, 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.