我在 Windows 8 C# XAML App 中使用 Coverflow 控件。
我正在尝试将此控件的选定 Item 属性绑定到一个属性,但这没有任何效果。以下是我正在使用的代码,让我知道我在做什么错误?
<controls:CoverFlow
Height="85"
Margin="0,40,0,0"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
SpaceBetweenItems="35"
SelectedItem="{Binding DiarySelectedItem.DiarySmileyId}"
SpaceBetweenSelectedItemAndItems="40"
ItemClick="ItemView_ItemClick"
ItemTemplate="{StaticResource 50ItemTemplate}"
ItemsSource="{Binding DiarySmileyIdOC}"
SelectedItemChanged="CoverFlow_SelectedItemChanged" />
/// <summary>
/// Sets and gets the DiarySelectedItem property.
/// Changes to that property's value raise the PropertyChanged event.
/// </summary>
public DiaryItemDetail DiarySelectedItem
{
get { return _diarySelectedItem; }
set
{
if (_diarySelectedItem == value)
{
return;
}
_diarySelectedItem = value;
RaisePropertyChanged(DiarySelectedItemPropertyName);
}
}
/// <summary>
/// Gets or sets the Diary Smiley Id Observable Collection.
/// </summary>
/// <value>
/// The Diary Smiley Id Observable Collection.
/// </value>
public ObservableCollection<int> DiarySmileyIdOC
{
get { return _diarySmileyIdOC; }
set
{
if (_diarySmileyIdOC == value)
{
return;
}
_diarySmileyIdOC = value;
// Update bindings, no broadcast
RaisePropertyChanged(DiarySmileyIdOCPropertyName);
}
}