Friday, 15 August 2014

c# - dependency property object doesn't update -


I have a problem updating good day dependency properties. Why does not it update after clicking the button Can you help me?

WpfApplication5.MainWindow

  using the system; Using System.Collections.Generic; Using System.Linq; Using System.Text; Using System.Windows; Using System.Windows.Controls; Using System.Windows.Data; Using System.Windows.Documents; Using System.Windows.Input; System.Windows.Media; System.Windows.Media Using imaging; Using System.Windows.Navigation; Using System.Windows.Shapes; Namespot WpfApplication5 {Public Partial Class Main Window: Window {TestData TD = New TestData (); Some structure SS = new structure (); Public manwindows () {SS.Name = "OIL"; TD.Name = "GOLD"; TD.CompanyName = SS; this. Datacontact = td; InitializeComponent (); } Private Zero Button 1_Click (Object Sender, RoutedEventArgs e) {SS.Name = "OIL2"; TD.CompanyName = SS; }} Public class Knhwartvalu: Ivalucontr {public object Convert (object value, the target type, object parameter system. Glolailaijheshnkkalcr Info Culture) {return value; } Public Object Knhwartbak (object value, Type type type, object parameter system. Glolailaijheshnkkalcr Info Culture) {return value; }} Certain structures of the public class {Public at option {get; Set; } Public string name {get; Set; }} Public Squared TestData: Dependency Object {public string name {get; Set; } Public String Assettyp {get; Set; } Public static read-only dependency property Kanpaninampanjikrn = dependence Proprtikniyntrn ( "Kanpaninam for" Taipf (a structure), Taipf (Testdeta), New Fremvrkproprti metadata (default (some Strccreshn), Fremvrkpropertimatetaoposhans. Bindstwovebadifolt)); Public Some Structure Company Name {get {return (someStructure) this.GetValue (CompanyNameProperty); } Set {this.SetValue (CompanyNameProperty, value); }}}}  

xaml code

  & lt; Window x: Class = "WpfApplication5.MainWindow" xmlns = "http: //schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns: x = "http://schemas.microsoft.com/winfx/2006/ Xaml "xmlns: local =" clr-namespace: wpfApplication5 "heading =" main window "height =" 350 "width =" 525 "& gt; & Lt; Window.Resources & gt; & Lt; Local: ConvertValue x: Key = "Sailby" & gt; & Lt; / Local: Convert Value & gt; & Lt; /Window.Resources> & Lt; Grid & gt; & Lt; Label x: name = "test label" width = "120" height = "25" content = "{binding company name, converter = {static resource selvi}}" & gt; & Lt; / Labels & gt; & Lt; Button Content = "button" height = "25" horizontal alignment = "Left" Margin = "340,143,0,0" name = "button 1 click" Carykshetrelinment = "top" width = "124" = "button L_klik" / Gt; & Lt; / Grid & gt;  

It seems that the UI does not know that the content is updated?

TD.CompanyName is not a new instance, there would be no information.


No comments:

Post a Comment