Created
October 22, 2017 13:11
-
-
Save andy51002000/a0e1a80cd522f4bcff3e3f6ed16e0456 to your computer and use it in GitHub Desktop.
Updated for ListBox_SelectionChanged
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Page | |
x:Class="SimpleMVVM.MainPage" | |
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |
xmlns:local="using:SimpleMVVM" | |
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |
mc:Ignorable="d" | |
DataContext="{Binding Source= {StaticResource ViewModelLocator}, Path=MovieListViewModel}" | |
> | |
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"> | |
<Grid.RowDefinitions> | |
<RowDefinition Height="Auto"/> | |
<RowDefinition Height="Auto"/> | |
<RowDefinition Height="Auto"/> | |
<RowDefinition Height="Auto"/> | |
</Grid.RowDefinitions> | |
<TextBlock Grid.Row="0" Text="Movie List" Margin="10" /> | |
<StackPanel Orientation="Vertical" Grid.Row="1"> | |
<ListBox Margin="10" | |
ItemsSource="{Binding Movies, Mode=TwoWay}" | |
SelectedItem="{Binding SelectedMovie, Mode=TwoWay}" | |
Height="250" | |
Width="Auto" | |
MaxWidth="450" | |
HorizontalAlignment="Left" | |
ScrollViewer.VerticalScrollBarVisibility="Auto" | |
SelectionChanged="ListBox_SelectionChanged" | |
> | |
<ListBox.ItemTemplate> | |
<DataTemplate> | |
<StackPanel Orientation="Vertical"> | |
<TextBlock Text="{Binding Name, Mode=TwoWay}"/> | |
<TextBlock Text="{Binding Price, Mode=TwoWay}"/> | |
</StackPanel> | |
</DataTemplate> | |
</ListBox.ItemTemplate> | |
</ListBox> | |
<Button Margin="10" Command="{Binding DeleteAllMoviesCommand}" Content="Clear all"/> | |
</StackPanel> | |
</Grid> | |
</Page> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment