Looping over XAML defined labels

后端 未结 6 1294
傲寒
傲寒 2021-01-18 08:58

I have a WPF application with many labels.

         


        
6条回答
  •  北海茫月
    2021-01-18 09:31

    If you work with binding it is easy. You just have to keep your label content in an ObservableCollection on your ViewModel. And then, you can do whatever you want with them, in your case iteration.

    Edit 1:

    Also your xaml should be something like:

            
                
                    
                        
                    
                
            
    

提交回复
热议问题