0
我對silverlight非常新,正在Silverlight 5中調用一個名爲pivotviewer的新控件。 我想從現有的silverlight 4代碼中爲pivot查看器編寫doubleclick事件。需要幫助將silverlight 4代碼翻譯爲silverlight 5
//double click event
private void PivotViewerControl_ItemDoubleClicked(object sender, ItemEventArgs e)
{
PivotItem piv_item =PivotViewerControl1.GetItem(e.ItemId);
if (!string.IsNullOrWhiteSpace(piv_item.Href))
{
PivotViewerControl1.CurrentItemId = e.ItemId;
OpenLink(piv_item.Href);
}
else
{
MessageBox.Show("No Web Page...");
}
}
while this translation to silverlight 5 where pivotviewer is inbuilt control that following stub are created for the event。
private void PivotViewerControl_ItemDoubleClicked(object sender, PivotViewerItemDoubleClickEventArgs e)
{
//here the pivotviewercontrol has not getitem() in silverlight 5 so How do i get the currently selected
//Item on the double click
}
此外,我沒有得到頁面加載本身的圖像。我的頁面加載代碼如下
public MainPage()
{
InitializeComponent();
PivotViewerControl.Loaded += PivotViewerControl_Loaded;
}
void PivotViewerControl_Loaded(object sender, RoutedEventArgs e)
{
_cxml = new CxmlCollectionSource(new Uri(MauritiusCollectionUri, UriKind.RelativeOrAbsolute));
_cxml.StateChanged += _cxml_StateChanged;
}
void _cxml_StateChanged(object sender, CxmlCollectionStateChangedEventArgs e)
{
if (e.NewState == CxmlCollectionState.Loaded)
{
PivotViewerControl.PivotProperties = _cxml.ItemProperties.ToList();
PivotViewerControl.ItemTemplates =_cxml.ItemTemplates;
PivotViewerControl.ItemsSource =_cxml.Items;
}
}
在運行時,我只是獲取圖像時,我排序或做一些搜索任何人都可以告訴我爲什麼?由於