1. 程式人生 > >關於UWP數據綁定的一個坑 x:bind修改為binding

關於UWP數據綁定的一個坑 x:bind修改為binding

bin markup led brush mar resource mic reg 一個

<Page
x:Class="AlbumCoverMatchGame.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:AlbumCoverMatchGame"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
xmlns:data="using:AlbumCoverMatchGame.Models">

<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Grid.RowDefinitions>
<RowDefinition Height="100"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>

<StackPanel Grid.Row="0">
<ProgressBar Name="myProressBar" Maximum="100" Minimum="0" Value="100" Height="20" Foreground="blue"/>
<TextBlock Name="InstructionTextBlock" Text="" Foreground="Blue" HorizontalAlignment="Center"/>
<MediaElement Name="MyMediaElement" AutoPlay="True"/>
</StackPanel>
<StackPanel Grid.Row="1" Orientation="Vertical">
<GridView Name="SongGridView"
ItemsSource="{Binding Songs}"
IsItemClickEnabled="True"
ItemClick="SongGridView_OnItemClick">
<GridView.ItemTemplate>
<DataTemplate>
<Grid>
<Image Name="AlbumArtImage"
Height="70"
Width="75"
Source="{Binding AlbumCover}"/> <!--這裏的x:bind修改為Binding識別屬性值 這是一個坑請註意>
</Grid>
</DataTemplate>
</GridView.ItemTemplate>
</GridView>

</StackPanel>
<Button Click="ButtonBase_OnClick" Content="Click Me"/>
</Grid>
</Page>

技術分享

關於UWP數據綁定的一個坑 x:bind修改為binding