WPF Label to TextBox

后端 未结 5 1609
长情又很酷
长情又很酷 2021-01-18 11:39

what is the best practice to show text label (e.g. \"Name\") with the TextBox in WPF? I want a label \"Name\" above the TextBox and many similar Labels/TextBoxes. Should I p

5条回答
  •  再見小時候
    2021-01-18 11:57

    Create a class X that holds label and text that implements INotifyPropertyChanged. Make an ObservableCollection. This will be the ItemsSource for ListBox, ComboBox, StackPanel.. whatever you choose. Create a DataTemplate that displays X the way you want it to.

提交回复
热议问题