Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"
- DataContext="{StaticResource vm}">
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="194*"/>
- <ColumnDefinition Width="489*"/>
- </Grid.ColumnDefinitions>
- <ListView HorizontalAlignment="Left"
- ItemsSource="{Binding Path=Places}"
- SelectedItem="{Binding Path=SelectedPlace, Mode=TwoWay}" Margin="0,96,0,0">
- <ListView.ItemTemplate>
- <DataTemplate>
- <StackPanel Orientation="Horizontal">
- <TextBlock Text="{Binding Path=Title}"/>
- </StackPanel>
- </DataTemplate>
- </ListView.ItemTemplate>
- </ListView>
- <StackPanel Grid.Column="0" HorizontalAlignment="Left">
- <TextBlock
- VerticalAlignment="Top"
- Text="{Binding SelectedPlace.Title}" Margin="0,64,0,0"/>
- </StackPanel>
- </Grid>
- Text="{Binding SelectedPlace.Title}"
- public class MainViewModel : ViewModelBase
- {
- public ObservableCollection<Place> Places { get; set; }
- public Place _selectedPlace { get; set; }
- public Place SelectedPlace
- {
- get { return _selectedPlace; }
- set { _selectedPlace = value; }
- }
- public MainViewModel()
- {
- Places = new ObservableCollection<Place>()
- {
- new Place() {Title = "London", Description = "London is a nice..."},
- new Place() {Title = "Dublin", Description = "Dublin is a ...."}
- };
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement