WPF textblock binding in XAML

前端 未结 5 2026
萌比男神i
萌比男神i 2021-01-22 21:40

I\'m updating some existing WPF code and my application has a number of textblocks defined like this:



        
5条回答
  •  深忆病人
    2021-01-22 22:34

    Before will work you have to make ObjectA itself a property because binding will only work with properties not fields.

    // my business object also contains another object like this
    public SomeOtherObject ObjectA { get; set; }
    
    public MyBusinessObject()
    {
        // constructor
        ObjectA = new SomeOtherObject();
    }
    

提交回复
热议问题