protected override void OnAttachedTo(BindableObject bindable) { base.OnAttachedTo(bindable); viewModel = new ListViewGridLayoutViewModel(); var mainPage = bindable as MainPage; listView = mainPage.FindByName <SfListView>("listView"); var headereGrid = mainPage.FindByName <Grid>("headerGrid"); headereGrid.BindingContext = viewModel; listView.ItemsSource = viewModel.Gallerynfo; listView.BindingContext = viewModel; listView.SelectionChanged += ListView_SelectionChanged; gridLayout = new GridLayout(); if (Device.RuntimePlatform == Device.Android || Device.RuntimePlatform == Device.iOS) { gridLayout.SpanCount = Device.Idiom == TargetIdiom.Phone ? 2 : 4; } else if (Device.RuntimePlatform == Device.UWP) { Debug.WriteLine(Device.RuntimePlatform); gridLayout.SpanCount = Device.Idiom == TargetIdiom.Desktop || Device.Idiom == TargetIdiom.Tablet ? 4 : 2; listView.ItemSize = Device.Idiom == TargetIdiom.Desktop || Device.Idiom == TargetIdiom.Tablet ? 230 : 140; } listView.LayoutManager = gridLayout; listView.DataSource.GroupDescriptors.Add(new GroupDescriptor() { PropertyName = "CreatedDate" }); }
protected override void OnAttachedTo(ContentPage bindable) { ListView = bindable.FindByName <SfListView>("listView"); Entry = bindable.FindByName <Entry>("entry"); ListView.SelectionChanged += ListView_SelectionChanged; base.OnAttachedTo(bindable); }
private async void OnLoadingAsync(object obj) { ListView = obj as SfListView; var firstItem = ListView.DataSource.DisplayItems[0]; this.GridIsVisible = false; this.IndicatorIsVisible = true; await Task.Delay(500); var r = new Random(); ListView.DataSource.BeginInit(); for (int i = 0; i < 5; i++) { var collection = new Message(); collection.Text = this.MessageText[r.Next(0, this.MessageText.Count() - 1)]; collection.IsIncoming = i % 2 == 0 ? true : false; collection.MessagDateTime = DateTime.Now.ToString(); this.Messages.Insert(0, collection); } ListView.DataSource.EndInit(); var firstItemIndex = ListView.DataSource.DisplayItems.IndexOf(firstItem); var header = (ListView.HeaderTemplate != null && !ListView.IsStickyHeader) ? 1 : 0; var totalItems = firstItemIndex + header; ListView.LayoutManager.ScrollToRowIndex(totalItems, true); this.GridIsVisible = true; this.IndicatorIsVisible = false; }
protected override void OnAttachedTo(ContentPage bindable) { sortButton = bindable.FindByName <Button>("sortButton"); ListView = bindable.FindByName <SfListView>("listView"); sortButton.Clicked += SortButton_Clicked; base.OnAttachedTo(bindable); }
protected override void OnAttachedTo(ContentPage bindable) { ListView = bindable.FindByName <SfListView>("listView"); ListView.ItemDragging += ListView_ItemDragging; base.OnAttachedTo(bindable); }
public TimerCreationPage() { InitializeComponent(); //timerItemTemplate = CreateTimerItemTemplate(); //timerSelectedItemTemplate = CreateTimerSelectedItemTemplate(); Vm = new TimerCreationPageViewModel(); layoutGrid = LayoutGrid; TimerListView = new SfListView() { HorizontalOptions = LayoutOptions.CenterAndExpand, VerticalOptions = LayoutOptions.CenterAndExpand, }; layoutGrid.Children.Add(TimerListView, 1, 1); TimerListView.VerticalOptions = LayoutOptions.FillAndExpand; TimerListView.HorizontalOptions = LayoutOptions.FillAndExpand; TimerListView.AutoFitMode = AutoFitMode.None; TimerListView.ItemSize = 100; TimerListView.SelectionMode = SelectionMode.Single; TimerListView.SetBinding(SfListView.ItemsSourceProperty, "TimerList"); TimerListView.ItemTemplate = CreateTimerItemTemplate(); TimerListView.SelectionChanged += TimerListView_SelectionChanged; Content = layoutGrid; }
protected override void OnAttachedTo(ContentPage bindable) { ListView = bindable.FindByName <SfListView>("listView"); ListView.DragDropController.UpdateSource = true; ListView.ItemDragging += ListView_ItemDragging; base.OnAttachedTo(bindable); }
/// <summary> /// You can override this method while View was detached from window /// </summary> /// <param name="bindAble">Sample View typed parameter named as bindAble</param> protected override void OnAttachedTo(SampleView bindAble) { this.viewModel = new PullToRefreshViewModel(); bindAble.BindingContext = this.viewModel; this.pullToRefresh = bindAble.FindByName <SfPullToRefresh>("pullToRefresh"); this.subGrid1 = bindAble.FindByName <Grid>("SubGrid1"); this.subGrid2 = bindAble.FindByName <Grid>("SubGrid2"); this.listView = bindAble.FindByName <SfListView>("listView"); this.transitionType = bindAble.FindByName <PickerExt>("transitionType"); this.label2 = bindAble.FindByName <Label>("label2"); this.label3 = bindAble.FindByName <Label>("label3"); this.imagedata = bindAble.FindByName <Image>("imagedata"); this.subGrid1.BindingContext = this.viewModel.Data; this.pullToRefresh.PullingThreshold = 100; this.listView.ItemsSource = this.viewModel.SelectedData; if (Device.RuntimePlatform == Device.iOS) { this.pullToRefresh.SizeChanged += this.Pull_SizeChanged; } this.pullToRefresh.Refreshing += this.PullToRefresh_Refreshing; this.pullToRefresh.Refreshed += this.PullToRefresh_Refreshed; this.listView.SelectionChanging += this.ListView_SelectionChanging; this.transitionType.Items.Add("Push"); this.transitionType.Items.Add("SlideOnTop"); this.transitionType.SelectedIndex = 1; this.transitionType.SelectedIndexChanged += this.OnSelectionChanged; base.OnAttachedTo(bindAble); }
protected override void OnDetachingFrom(ContentPage bindable) { ThemeButton.Clicked -= ThemeButton_Clicked; ThemeButton = null; ListView = null; base.OnDetachingFrom(bindable); }
protected override void OnAttachedTo(ContentPage bindable) { ListView = bindable.FindByName <SfListView>("listView"); SearchBar = bindable.FindByName <SearchBar>("filterText"); SearchBar.TextChanged += SearchBar_TextChanged; base.OnAttachedTo(bindable); }
protected override void OnDetachingFrom(ContentPage bindable) { SearchBar.TextChanged -= SearchBar_TextChanged; SearchBar = null; ListView = null; base.OnDetachingFrom(bindable); }
protected override void OnDetachingFrom(ContentPage bindable) { base.OnDetachingFrom(bindable); listview.ItemDragging -= Listview_ItemDragging; listview = null; button = null; }
public HomePageMaster() { InitializeComponent(); BindingContext = new HomePageMasterViewModel(); ListView = MenuItemsListView; }
protected override void OnAttachedTo(ContentPage bindable) { ListView = bindable.FindByName <SfListView>("ListView"); ListView.Loaded += ListView_Loaded; visualContainer = ListView.GetVisualContainer(); base.OnAttachedTo(bindable); }
protected override void OnAttachedTo(ContentPage bindable) { ListView = bindable.FindByName <SfListView>("list"); GridView = bindable.FindByName <Grid>("GridView"); ListView.BindingContext = new ContactsViewModel(); ListView.ItemTapped += ListView_ItemTapped; base.OnAttachedTo(bindable); }
protected override void OnDetachingFrom(ContentPage bindable) { base.OnDetachingFrom(bindable); ToDoListView.ItemDragging -= ToDoListView_ItemDragging; WorkDoneListView.ItemDragging -= WorkDoneListView_ItemDragging; ToDoListView = null; WorkDoneListView = null; }
protected override void OnAttachedTo(ContentPage bindable) { base.OnAttachedTo(bindable); listView = bindable.FindByName <SfListView>("listView"); viewModel.listView = listView; listView.BindingContext = viewModel; listView.ItemsSource = viewModel.ContactsInfo; }
protected override void OnDetachingFrom(ContentPage bindable) { Button.Clicked -= Button_Clicked; Button = null; ListView = null; Container = null; base.OnDetachingFrom(bindable); }
protected override void OnAttachedTo(ContentPage bindable) { listView = bindable.FindByName <SfListView>("listView"); listView.ItemGenerator = new ItemGeneratorExt(listView); searchBar = bindable.FindByName <SearchBar>("filterText"); searchBar.TextChanged += SearchBar_TextChanged; base.OnAttachedTo(bindable); }
public MasterDetailMaster() { InitializeComponent(); BindingContext = new MasterDetailMasterViewModel(); ListView = MenuItemsListView; }
/// <summary> /// You can override this method to subscribe to AssociatedObject events and initialize properties. /// </summary> /// <param name="bindAble">SampleView type parameter bindAble</param> protected override void OnAttachedTo(SampleView bindAble) { (bindAble.Resources["NotificationPopUp"] as SfPopupLayout).Show(); this.listview = bindAble.FindByName <SfListView>("listView"); this.listview.ItemTapped += this.ListView_ItemTapped; this.popupLayout = bindAble.FindByName <SfPopupLayout>("popUp"); }
protected override void OnAttachedTo(ContentPage bindable) { ListView = bindable.FindByName <SfListView>("listView"); button = bindable.FindByName <Button>("Button"); scrollview = ListView.GetScrollView(); button.Clicked += Button_Clicked; base.OnAttachedTo(bindable); }
protected override void OnDetachingFrom(ContentPage bindable) { AddButton.Clicked += AddButton_Clicked; ListView = null; AddButton = null; ViewModel = null; base.OnDetachingFrom(bindable); }
public ResourceListView(ViewModelBase bindingContext) { BindingContext = bindingContext; var searchBar = new SearchBar { Placeholder = "Search to filter" }; searchBar.TextChanged += ((sender, args) => ((ResourceListViewModel)BindingContext).OnFilterTextChanged(sender, args, _listView)); _listView = new SfListView { ItemsSource = ((ResourceListViewModel)BindingContext).Resources, SelectionMode = SelectionMode.Single, SelectionGesture = TouchGesture.Tap, SelectionBackgroundColor = Color.LightGray, AutoFitMode = AutoFitMode.Height, ItemTemplate = new DataTemplate(() => { var name = new Label { FontAttributes = FontAttributes.Bold, FontSize = 21, }; name.SetBinding(Label.TextProperty, "Name"); var description = new Label { FontSize = 15 }; description.SetBinding(Label.TextProperty, "Description"); var stackLayout = new StackLayout { Children = { name, description } }; return(stackLayout); }) }; _listView.Loaded += ((ResourceListViewModel)BindingContext).GenerateResourcesEvent; _listView.DataSource.SortDescriptors.Add(new SortDescriptor { PropertyName = "Name", Direction = ListSortDirection.Ascending, }); _listView.ItemTapped += ((ResourceListViewModel)BindingContext).ItemTappedEvent; Content = new StackLayout { HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, Padding = 30, Spacing = 10, Children = { searchBar, _listView } }; }
private void ListView_QueryItemSize(object sender, Syncfusion.ListView.XForms.QueryItemSizeEventArgs e) { SfListView view = (SfListView)sender; Collection <ItemModel> Source = (Collection <ItemModel>)view.ItemsSource; int height = (Source == null ? 1 : (Source.Count < e.ItemIndex ? 1 : Source[e.ItemIndex].Items.Count)); e.ItemSize = 110 + (45 * height); e.Handled = true; }
protected override void OnAttachedTo(ContentPage bindable) { ListView = bindable.FindByName <SfListView>("listView"); Button = bindable.FindByName <Button>("scrollButton"); Container = ListView.GetVisualContainer(); Button.Clicked += Button_Clicked; base.OnAttachedTo(bindable); }
protected override void OnAttachedTo(ContentPage bindable) { ListView = bindable.FindByName <SfListView>("listView"); SearchBar = bindable.FindByName <SearchBar>("filterText"); SearchBar.TextChanged += SearchBar_TextChanged; ListView.SelectionController = new SelectionControllerExt(ListView); ListView.SelectionChanged += SFlistView_SelectionChanged; base.OnAttachedTo(bindable); }
public MakeNewRouteAutoPage() { InitializeComponent(); _vm = new MakeNewRouteAutoViewModel(); _vm.Navigation = this.Navigation; _listView = FindByName("sfListRoutePoints") as SfListView; _collectionImagesFirstView = FindByName("CollectionViewImagesFirst") as CollectionView; BindingContext = _vm; }
public MainPageViewModel(SfListView List) { ListView = List; ContactsInfo = new ObservableCollection <Contacts>(); LoadMoreItemsCommand = new Command <object>(LoadMoreItems, CanLoadMoreItems); SwipeEndedCommand = new Command <object>(OnSwipeEnded); SwipeRightCommand = new Command <object>(OnSwipeRight); GenerateItems(5); }
public CustomItemGenerator(SfListView listView, ICommand editCommand, ICommand deleteCommand) : base(listView) { _listView = listView; _editCommand = editCommand; _deleteCommand = deleteCommand; }