2014-09-11 15 views
0

我想了解Xamarin.Forms,雖然有很多可用的示例,但沒有多少評論。 我想使用FormsGallery MasterDetailDemoPage(在這裏找到https://github.com/xamarin/xamarin-forms-samples/blob/master/FormsGallery/FormsGallery/FormsGallery/MasterDetailPageDemoPage.cs)或CarouselPage(在這裏找到https://github.com/xamarin/xamarin-forms-samples/blob/master/FormsGallery/FormsGallery/FormsGallery/CarouselPageDemoPage.cs),但我需要能夠處理生成的頁面上的點擊事件。Xamarin.Forms FormsGallery MasterDetailDemoPage生成頁面上的點擊事件

的NamedColorPage(這裏發現在這兩方面的例子中使用。

我沒有問題,產生的頁面,但我怎麼處理點擊生成的頁面事件。

例如,如果NamedColor對象有稱那是列表記述的另一個屬性,我想點擊該帶我到另一個網頁,顯示了描述NamedColorPage按鈕/ s的我會怎麼做呢?

Button colourDescription = new Button 
{ 
    Text = "Description 
}; 

colourDescription.Clicked += (sender, e) => 
{ 

    //open page showing description here 

} 

我認爲這與SetBinding或BindingContext有關,但其中的任何文檔都非常有限,並且沒有針對完整的新手。

在此先感謝

回答

0

工作了

Color col = (Color)BindingContext; 

然後

List<string> descr = col.Description; 
相關問題