Binding objects defined in code-behind

前端 未结 11 1291
难免孤独
难免孤独 2020-11-28 04:29

I have some object that is instantiated in code behind, for instance, the XAML is called window.xaml and within the window.xaml.cs

protected Dictionary

        
11条回答
  •  隐瞒了意图╮
    2020-11-28 04:29

    One way would be to create an ObservableCollection (System.Collections.ObjectModel) and have your dictionary data in there. Then you should be able to bind the ObservableCollection to your ListBox.

    In your XAML you should have something like this:

    
    

提交回复
热议问题