Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2014
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.63 KB | None | 0 0
  1. <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"
  2. DataContext="{StaticResource vm}">
  3. <Grid.ColumnDefinitions>
  4. <ColumnDefinition Width="194*"/>
  5. <ColumnDefinition Width="489*"/>
  6. </Grid.ColumnDefinitions>
  7. <ListView HorizontalAlignment="Left"
  8. ItemsSource="{Binding Path=Places}"
  9. SelectedItem="{Binding Path=SelectedPlace, Mode=TwoWay}" Margin="0,96,0,0">
  10. <ListView.ItemTemplate>
  11. <DataTemplate>
  12. <StackPanel Orientation="Horizontal">
  13. <TextBlock Text="{Binding Path=Title}"/>
  14. </StackPanel>
  15. </DataTemplate>
  16. </ListView.ItemTemplate>
  17. </ListView>
  18.  
  19. <StackPanel Grid.Column="0" HorizontalAlignment="Left">
  20.  
  21. <TextBlock
  22. VerticalAlignment="Top"
  23. Text="{Binding SelectedPlace.Title}" Margin="0,64,0,0"/>
  24. </StackPanel>
  25.  
  26.  
  27. </Grid>
  28.  
  29. Text="{Binding SelectedPlace.Title}"
  30.  
  31. public class MainViewModel : ViewModelBase
  32. {
  33. public ObservableCollection<Place> Places { get; set; }
  34.  
  35. public Place _selectedPlace { get; set; }
  36.  
  37. public Place SelectedPlace
  38. {
  39. get { return _selectedPlace; }
  40. set { _selectedPlace = value; }
  41. }
  42.  
  43. public MainViewModel()
  44. {
  45. Places = new ObservableCollection<Place>()
  46. {
  47. new Place() {Title = "London", Description = "London is a nice..."},
  48. new Place() {Title = "Dublin", Description = "Dublin is a ...."}
  49. };
  50. }
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement