Skip to content

Instantly share code, notes, and snippets.

@andy51002000
Last active October 21, 2017 10:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andy51002000/eda297ed63a029a165183418b623352c to your computer and use it in GitHub Desktop.
Save andy51002000/eda297ed63a029a165183418b623352c to your computer and use it in GitHub Desktop.
Present Movies List. Click Button "Clear" will delete all data from view and database
<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"
>
<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