本文整理汇总了C#中Xamarin.Forms.SelectedItemChangedEventArgs类的典型用法代码示例。如果您正苦于以下问题:C# SelectedItemChangedEventArgs类的具体用法?C# SelectedItemChangedEventArgs怎么用?C# SelectedItemChangedEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SelectedItemChangedEventArgs类属于Xamarin.Forms命名空间,在下文中一共展示了SelectedItemChangedEventArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DeviceSelected
void DeviceSelected (object sender, SelectedItemChangedEventArgs e)
{
var device = e.SelectedItem as IDevice;
if (device != null) {
App.BluetoothAdapter.ConnectToDevice(device);
}
}
示例2: OnSelected
// Event handlers
public async void OnSelected(object sender, SelectedItemChangedEventArgs e)
{
var todo = e.SelectedItem as TodoItemViewModel;
if (todo != null)
{
var detailsView = new TodoItemDetailsView();
detailsView.BindingContext = todo;
await Navigation.PushAsync(detailsView);
}
//if (Device.OS != TargetPlatform.iOS && todo != null)
//{
// // Not iOS - the swipe-to-delete is discoverable there
// if (Device.OS == TargetPlatform.Android)
// {
// await DisplayAlert(todo.Name, "Press-and-hold to delete task " + todo.Name, "Got it!");
// }
// else
// {
// // Windows, not all platforms support the Context Actions yet
// if (await DisplayAlert("Delete?", "Do you wish to delete " + todo.Name + "?", "Delete", "Cancel"))
// {
// await DeleteItem(todo);
// }
// }
//}
// prevents background getting highlighted
todoList.SelectedItem = null;
}
示例3: List_ItemSelected
private async void List_ItemSelected(object sender, SelectedItemChangedEventArgs e)
{
var vm = e.SelectedItem as ExampleViewCellModel;
var list = sender as ListView;
if (vm == null || list == null)
{
return;
}
var pageType = _pages[vm];
// create the page object
var page = Activator.CreateInstance(pageType) as Page;
if (page == null)
{
await MainPage.DisplayAlert("Error", "Couldn't display page.", "OK");
return;
}
page.Title = vm.Title;
var animation = vm.TappedAnimation as IAsyncCommand;
var reset = vm.Reset;
if (animation != null)
{
await animation.ExecuteAsync(null);
}
await MainPage.Navigation.PushAsync(page, true);
list.SelectedItem = null;
reset.Execute(null);
}
示例4: OnItemSelected
public void OnItemSelected (object sender, SelectedItemChangedEventArgs e) {
var r = (Restaurant)e.SelectedItem;
var rPage = new RestaurantDetail();
rPage.BindingContext = r;
Navigation.PushAsync(rPage);
}
示例5: OnListItemSelected
public async void OnListItemSelected(object sender, SelectedItemChangedEventArgs e)
{
System.Diagnostics.Debug.WriteLine("hmm");
try
{
categoryList.ScrollTo(categoryList.SelectedItem, ScrollToPosition.Center, true);
EventCategoryListItem selectedCategory = categoryList.SelectedItem as EventCategoryListItem;
categoryImage.Source = selectedCategory.ImageSource;
await Task.Delay(500);
categoryImage.IsVisible = true;
categoryImage.FadeTo(0, 300, null);
await categoryImage.ScaleTo(2, 150, null);
categoryList.IsVisible = false;
await categoryImage.ScaleTo(4, 150, null);
categoryImage.Scale = 1;
categoryImage.Opacity = 1;
categoryImage.IsVisible = false;
searchBar.Text = "#" + selectedCategory.Category;
categoryList.SelectedItem = null;
}
catch (Exception ex)
{
}
}
示例6: AnswerList_ItemSelected
void AnswerList_ItemSelected(object sender, SelectedItemChangedEventArgs e)
{
if (Device.OS == TargetPlatform.Android)
{
}
}
示例7: OnListItemSelected
public void OnListItemSelected (object sender, SelectedItemChangedEventArgs e)
{
if (e.SelectedItem != null) {
if (e.SelectedItem is CategoryViewModel) {
Category selectedCategory = ((CategoryViewModel)e.SelectedItem).Category;
//probably should not display category at all, but now its better than crash
if (selectedCategory.Articles.Count == 0)
return;
ContentPage nextPage;
if (selectedCategory.Articles.Count > 1) {
nextPage = new ArticleListPage () { ViewModel = new ArticleListViewModel (selectedCategory) };
} else {
nextPage = new TextArticlePage () { ViewModel = new ArticleViewModel (selectedCategory.Articles [0]) };
}
Navigation.PushAsync (nextPage);
} else if (e.SelectedItem is ArticleViewModel) {
ArticleViewModel selectedSearchArtile = (ArticleViewModel)e.SelectedItem;
var articlePage = new TextArticlePage () { ViewModel = selectedSearchArtile };
Navigation.PushAsync (articlePage);
}
myListView.SelectedItem = null;
}
}
示例8: OnSelection
void OnSelection (object sender, SelectedItemChangedEventArgs e)
{
if (e.SelectedItem == null) {
return; //ItemSelected is called on deselection, which results in SelectedItem being set to null
}
Sections s = (Sections)e.SelectedItem;
switch (s.SectionName) {
case "Geometric Brownian Motion":
SimulatingAndAnalyzingAssetPrices.RandomWalk rw = new SimulatingAndAnalyzingAssetPrices.RandomWalk (10.0);
Navigation.PushAsync (new BrownianMotionChartPage (rw.BrownianSeq, rw.BrownianSeq1, rw.BrownianSeq2));
break;
case "MSFT Actual vs. GBM":
var item = e.SelectedItem;
Navigation.PushAsync (new CompareMsftHistoricalVolDriftChartPage ());
break;
case "Msft vs. Improved GBM":
// this is not properly implemented. needs non optimized drift/vol
// SimulatingAndAnalyzingAssetPrices.RandomWalk rw = new SimulatingAndAnalyzingAssetPrices.RandomWalk (10.0);
Navigation.PushAsync (new CompareMsftGbmChartPage ());
break;
}
;
((ListView)sender).SelectedItem = null;
}
示例9: OrderList_OnItemSelected
private async void OrderList_OnItemSelected(object sender, SelectedItemChangedEventArgs e)
{
if (e.SelectedItem == null) return;
var selectedItem = e.SelectedItem as OrderItemViewModel;
var orderDetailVm = await vm.GetViewModelForOrderDetail(selectedItem);
await Navigation.PushAsync(new OrderDetailsPage(orderDetailVm), true);
}
示例10: FoodList_OnItemSelected
private async void FoodList_OnItemSelected(object sender, SelectedItemChangedEventArgs e)
{
if (e.SelectedItem == null) return;
var selectedItem = vm.FoodItems.First(x => x.Name == (e.SelectedItem as Food).Name);
await Navigation.PushAsync(new FoodDetailPage(new FoodDetailViewModel(selectedItem)), true);
}
示例11: ListPages_ItemSelected
void ListPages_ItemSelected (object sender, SelectedItemChangedEventArgs e)
{
if (e.SelectedItem != null) {
this.Navigation.PushAsync ((Page)e.SelectedItem);
}
listPages.SelectedItem = null;
}
示例12: OnItemSelected
private void OnItemSelected(object sender, SelectedItemChangedEventArgs e)
{
var listView = sender as CustomListView;
if (listView != null) {
listView.SelectedItem = null;
}
var todoModel = e.SelectedItem as TodoModel;
if (todoModel != null) {
var todoDetails = new TodoDetailsPage (rootPage, todoModel);
todoDetails.BackButtonClicked += (s, arg) => {
contentPageArea.Children.Remove (todoDetails);
};
todoDetails.RemoveButtonClicked += (sender1, args) => {
App.DataBase.RemoveTodo (todoModel.Id);
ResetListData ();
contentPageArea.Children.Remove (todoDetails);
};
todoDetails.SaveButtonClicked += (sender1, args) => {
var todo = args.Todo;
App.DataBase.AddOrUpdateTodo (todo);
ResetListData ();
contentPageArea.Children.Remove (todoDetails);
};
contentPageArea.Children.Add (todoDetails, new Rectangle (0f, 0f, 1f, 1f), AbsoluteLayoutFlags.All);
}
}
示例13: OnSelect
public void OnSelect(object sender, SelectedItemChangedEventArgs e)
{
if (EditMode)
{
// Get the item selected
var rcLD = (ListData)e.SelectedItem;
// Display the Details view.
var view = new ListDataDetailsView(_sListType, rcLD);
Navigation.PushAsync(view);
}
else
{
// get the item selected
var ListD = (ListData)e.SelectedItem;
switch (_sListType)
{
case "ITEMTYPE":
App.selectedItemType = ListD.ListDesc;
break;
case "ACTIVITYTYPE":
App.selectedActivityType = ListD.ListDesc;
break;
case "MANUFACTURER":
// get the item selected
var ListI = (ListItem)e.SelectedItem;
App.selectedManufacturer = ListI.ListDesc;
break;
}
// tell the navigator to show the new view
Navigation.PopAsync();
}
}
示例14: OnItemSelected
public void OnItemSelected(object sender, SelectedItemChangedEventArgs e)
{
if (e.SelectedItem == null) return; // has been set to null, do not 'process' tapped event
var memberBarrier = ((ListView)sender).SelectedItem as MemberBarriers;
((ListView)sender).SelectedItem = null; // de-select the row
Navigation.PushModalAsync(new BarrierStrategyModal(SelectedUser, null, memberBarrier));
}
示例15: Onselected
// Determines what happens when an element from the list is chosen by the user.
void Onselected(object sender, SelectedItemChangedEventArgs e)
{
if (e.SelectedItem == null){
return;
}
// This deselects the item after it is selected.
((ListView)sender).SelectedItem = null;
var select = e.SelectedItem as OnlineVViewModel;
if (Helpers.Settings.SpeechSetting)
{
CrossTextToSpeech.Current.Speak(select.Title);
}
VideoPage temp = new VideoPage(select.Title, select.URL);
if (Device.OS == TargetPlatform.iOS)
{
NavigationPage.SetHasNavigationBar(temp, true);
}
else
{
NavigationPage.SetHasNavigationBar(temp, false);
}
// Show the selected video to the user.
Navigation.PushAsync(temp);
}