Home > Net >  (WPF) code to add data binding is invalid
(WPF) code to add data binding is invalid

Time:10-12


This is my user control code

Mainwindow as shown there are two buttons, I test points in the first button, first come out the value of more than seven hundred and 0, the second button and then points the first button is still the same,
However I manually add the xaml data binding and then test point out the first button is the same two values,
Why is this? Not science! Big help genuflect is begged! In this for several hours almost doubt life!

CodePudding user response:

supplement the picture

CodePudding user response:

Purpose is to let the user control the display in the aspect of user control actual aspect changes, the user controls the width of moment and window width, the user controls the display of the content will be updated time according to the size of the window,

CodePudding user response:

Should not be in the mainwindow is enclosing setbinding

CodePudding user response:

reference stherix reply: 3/f
should not be in the mainwindow enclosing setbinding?

Bing's source and the object are mapDisplay controls

CodePudding user response:

In mapDisplay specified in the constructor of the current UserControl DataContext=this; Should not specify actualwidth attribute values, such as controls have default actualwidth value, the value of the assignment in layout is completed,
  •  Tags:  
  • C#
  • Related