Skip to content

Instantly share code, notes, and snippets.

@preslavrachev
Created January 4, 2011 12:09
Show Gist options
  • Save preslavrachev/764705 to your computer and use it in GitHub Desktop.
Save preslavrachev/764705 to your computer and use it in GitHub Desktop.
<UserControl x:Class="MVVMSimpleDemo.View.QuestionView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:viewmodel="clr-namespace:MVVMSimpleDemo.ViewModel"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="400">
<UserControl.Resources>
<viewmodel:QuestionViewModel x:Key="ViewModel" />
</UserControl.Resources>
<Grid x:Name="LayoutRoot" Background="White" DataContext="{Binding Source={StaticResource ViewModel}}">
<StackPanel Orientation="Vertical" Height="100" HorizontalAlignment="Left" Margin="1,12,0,0" Name="stackPanel1" VerticalAlignment="Top" Width="400" >
<ItemsControl ItemsSource="{Binding Path=Questions}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="200" />
<ColumnDefinition Width="50" />
<ColumnDefinition Width="50" />
</Grid.ColumnDefinitions>
<TextBox x:Name="QuestionText" Text="{Binding Path=Text}" Grid.Column="0" />
<TextBox x:Name="ProvidedAnswer" Text="{Binding Path=ProvidedAnswer, Mode=TwoWay}" Grid.Column="1"/>
<CheckBox x:Name="GradeCheckBox" IsChecked="{Binding Path=Grade}" Grid.Column="2" />
</Grid>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<Button Content="Grade" FontSize="18" />
</StackPanel>
</Grid>
</UserControl>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment