daily pastebin goal
7%
SHARE
TWEET

Untitled

a guest Jan 22nd, 2019 57 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ## XAML
  2.  
  3.     <StackPanel>
  4.         <ListBox IsSynchronizedWithCurrentItem="True" ItemsSource="{Binding}">
  5.             <ListBox.ItemTemplate>
  6.                 <DataTemplate>
  7.                     <Label Content="{Binding Name}"/>
  8.                 </DataTemplate>
  9.             </ListBox.ItemTemplate>
  10.         </ListBox>
  11.         <StackPanel>
  12.             <Label>Name</Label>
  13.             <TextBox Text="{Binding /Name}"/>
  14.             <Label>Age</Label>
  15.             <TextBox Text="{Binding /Age}"/>
  16.         </StackPanel>
  17.     </StackPanel>
  18.  
  19. ## Code
  20.  
  21.  public partial class MainWindow : Window
  22.     {
  23.         public MainWindow()
  24.         {
  25.             InitializeComponent();
  26.  
  27.             var people = new ObservableCollection<Person>
  28.             {
  29.                 new Person { Name = "Omar Abou Mrad", Age = 32 },
  30.                 new Person { Name = "John", Age = 10 }
  31.             };
  32.  
  33.             this.DataContext = people;
  34.         }
  35.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top