我有以下
g code
<GridView
x:Name="itemGridView"
AutomationProperties.AutomationId="ItemsGridView"
AutomationProperties.Name="Items"
TabIndex="1"
Grid.RowSpan="2"
Padding="116,136,116,46"
SelectionMode="Single"
IsSwipeEnabled="false"
Visibility="Collapsed">
<GridView.ItemTemplate>
<DataTemplate>
<Border BorderBrush="DarkSeaGreen" BorderThickness="1">
<StackPanel HorizontalAlignment="Left" Width="250" Height="180" Background="SeaGreen">
<StackPanel VerticalAlignment="Top" >
<TextBlock Text="{Binding Name}" Foreground="{StaticResource ListViewItemOverlayForegroundThemeBrush}" TextWrapping="Wrap" MinHeight="40" FontSize="22" Margin="15,10,15,0"/>
</StackPanel>
<Grid Height="Auto">
<Grid.RowDefinitions>
<RowDefinition Height="20*"/>
<RowDefinition Height="20*"/>
<RowDefinition Height="20*"/>
<RowDefinition Height="20*"/>
<RowDefinition Height="20*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="150"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Row="0" Grid.Column="0" Text="TotalMarks:" Foreground="White" Style="{StaticResource CaptionTextStyle}" TextWrapping="NoWrap" Margin="15,0,0,0"/>
<TextBlock Grid.Row="0" Grid.Column="1" Text="{Binding TotalMarks}" Foreground="White" Style="{StaticResource CaptionTextStyle}" TextWrapping="NoWrap"/>
<TextBlock Grid.Row="1" Grid.Column="0" Text="Total Questions:" Foreground="White" Style="{StaticResource CaptionTextStyle}" TextWrapping="NoWrap" Margin="15,0,0,0" />
<TextBlock Grid.Row="1" Grid.Column="1" Text="{Binding TotalQuestions}" Foreground="White" Style="{StaticResource CaptionTextStyle}" TextWrapping="NoWrap" />
<TextBlock Grid.Row="2" Grid.Column="0" Text="Total attempts:" Foreground="White" Style="{StaticResource CaptionTextStyle}" TextWrapping="NoWrap" Margin="15,0,0,0" />
<TextBlock Grid.Row="2" Grid.Column="1" Text="{Binding AttemptCount}" Foreground="White" Style="{StaticResource CaptionTextStyle}" TextWrapping="NoWrap" />
<TextBlock Grid.Row="3" Grid.Column="0" Text="Ratings:" Foreground="White" Style="{StaticResource CaptionTextStyle}" TextWrapping="NoWrap" Margin="15,0,0,0" />
<TextBlock Grid.Row="3" Grid.Column="1" Text="{Binding TestRating}" Foreground="White" Style="{StaticResource CaptionTextStyle}" TextWrapping="NoWrap" />
<!-- Here I want to add -->
</Grid>
</StackPanel>
</Border>
</DataTemplate>
</GridView.ItemTemplate>
</GridView>
我想在数据模板的网格中添加一个评级控件,以便它的值可以与一个整数变量绑定TestRating
。由于我是数据绑定的新手,所以我不知道如何做到这一点。请提供一些帮助。
提前致谢。