public NativeListViewAdapter( ListView listView, global::Android.Content.Context context, ListViewSource source) { if (null == listView) { throw new ArgumentNullException(nameof(listView)); } if (null == context) { throw new ArgumentNullException(nameof(context)); } if (null == source) { throw new ArgumentNullException(nameof(source)); } this._listView = listView; this._context = context; this._items = source; this._items.CollectionChanged += Source_CollectionChanged; }
private void _pairTimer_Tick(object sender, EventArgs e) { CommandResult bresult = _selectedBridge.CreateUser("WinHue"); string result = string.Empty; if (bresult.Success) { result = (string)bresult.resultobject; } ProgressBarValue += 2; if (result == string.Empty) { return; } ProgressBarValue = ProgressBarMax; ListViewSource[ListViewSource.IndexOf(_selectedBridge)].ApiKey = result; UserMessage = GlobalStrings.BridgeDetectionPairing_PairingDone; if (BridgeStore.ListBridges.Count == 1) { SetDefaultBridge(); } CanChangeSelection = true; _pairTimer.Stop(); _timeoutTimer.Stop(); }
//private void NativeListView_ItemClick( // object sender, // ItemClickEventArgs e) //{ // if (null == e) // { // return; // } // var item = e.ClickedItem as CustomItem; // if (null == item) // { // return; // } // ((IListViewDelegate)this.Element).NotifyItemClicked(null, null, item.Item, item.Container?.View); //} public void Bind( ListViewSource source) { this._nativeListView?.Adapter?.Dispose(); this._nativeListView.Adapter = new NativeListViewAdapter((ListView)this.Element, this.NativeContext, source); }
public HomeViewModel() { CarouselViewSource.Add(new NewsListItemModel() { Image = "http://imgsize.ph.126.net/?imgurl=http://cms-bucket.nosdn.127.net/4d6bdb8778ef4f4284d66f74df0d9b5520170404121443.jpeg_320x200x1x85.jpg", Title = "如果现在你是穷人,十年后你可能还会一贫如洗" }); CarouselViewSource.Add(new NewsListItemModel() { Image = "http://imgsize.ph.126.net/?imgurl=http://cms-bucket.nosdn.127.net/6f7521996d894108a9319bc6b9aed93720170403123502.jpeg_320x200x1x85.jpg", Title = "毁掉孩子未来的,可能就是父母的这句话" }); CarouselViewSource.Add(new NewsListItemModel() { Image = "http://imgsize.ph.126.net/?imgurl=http://cms-bucket.nosdn.127.net/a474fbfb13944245be6cbd64d22b9f1b20170404131846.jpeg_320x200x1x85.jpg", Title = "清明:有些词,只是叫一叫就让人喉间哽咽" }); ListViewSource.Add(new NewsListItemModel() { Image = "http://imgsize.ph.126.net/?imgurl=http://cms-bucket.nosdn.127.net/f290a0c0074e4275b7f50a158841f41920170404220135.png_140x88x1x85.jpg", Title = "朴槿惠狱中首讯:涉13项指控均否认 19日收押到期", Column = "新闻" }); ListViewSource.Add(new NewsListItemModel() { Image = "http://imgsize.ph.126.net/?imgurl=http://cms-bucket.nosdn.127.net/f290a0c0074e4275b7f50a158841f41920170404220135.png_140x88x1x85.jpg", Title = "朴槿惠狱中首讯:涉13项指控均否认 19日收押到期", Column = "新闻" }); ListViewSource.Add(new NewsListItemModel() { Image = "http://imgsize.ph.126.net/?imgurl=http://cms-bucket.nosdn.127.net/f290a0c0074e4275b7f50a158841f41920170404220135.png_140x88x1x85.jpg", Title = "朴槿惠狱中首讯:涉13项指控均否认 19日收押到期", Column = "新闻" }); ListViewSource.Add(new NewsListItemModel() { Image = "http://imgsize.ph.126.net/?imgurl=http://cms-bucket.nosdn.127.net/f290a0c0074e4275b7f50a158841f41920170404220135.png_140x88x1x85.jpg", Title = "朴槿惠狱中首讯:涉13项指控均否认 19日收押到期", Column = "新闻" }); ListViewSource.Add(new NewsListItemModel() { Image = "http://imgsize.ph.126.net/?imgurl=http://cms-bucket.nosdn.127.net/f290a0c0074e4275b7f50a158841f41920170404220135.png_140x88x1x85.jpg", Title = "朴槿惠狱中首讯:涉13项指控均否认 19日收押到期", Column = "新闻" }); ListViewSource.Add(new NewsListItemModel() { Image = "http://imgsize.ph.126.net/?imgurl=http://cms-bucket.nosdn.127.net/f290a0c0074e4275b7f50a158841f41920170404220135.png_140x88x1x85.jpg", Title = "朴槿惠狱中首讯:涉13项指控均否认 19日收押到期", Column = "新闻" }); }
public void Bind( ListViewSource source) { if (null == source) { throw new ArgumentNullException(nameof(source)); } this._source = source; this._customSource = new NativeListViewSource(source); this.ItemsSource = this._customSource; }
public NativeListViewSource( ListViewSource source) { if (null == source) { throw new ArgumentNullException(nameof(source)); } this._source = source; this._customItemMap = new Dictionary <object, NativeListViewItem>(); this._source.CollectionChanged += Source_CollectionChanged; }
private async void OnSourChanged(Uri uri) { try { pnlStatus.Visibility = Visibility.Collapsed; IsLoading = true; var f = await StorageFile.GetFileFromPathAsync(uri.LocalPath); _currentPdfDoc = await PdfDocument.LoadFromFileAsync(f); if (_currentPdfDoc == null) { return; } for (uint i = 0; i < _currentPdfDoc.PageCount; i++) { lblLiveStatus.Text = $"Loading Page {i + 1} out of {_currentPdfDoc.PageCount}"; var page = _currentPdfDoc.GetPage(i); var pageData = new InMemoryRandomAccessStream(); var aspectRatio = page.Size.Width / page.Size.Height; var size = new Size(RenderWidth, RenderWidth / aspectRatio); await page.RenderToStreamAsync(pageData, new PdfPageRenderOptions { BackgroundColor = Colors.White, DestinationWidth = (uint)size.Width, DestinationHeight = (uint)size.Height }); var bimg = new BitmapImage(); await bimg.SetSourceAsync(pageData); ListViewSource.Add(bimg); } IsLoading = false; } catch (Exception ex) { IsLoading = false; lblStatus.Text = ex.ToString(); pnlStatus.Visibility = Visibility.Visible; } }
//private void NativeListView_ItemClick( // object sender, // ItemClickEventArgs e) //{ // if (null == e) // { // return; // } // var item = e.ClickedItem as CustomItem; // if (null == item) // { // return; // } // ((IListViewDelegate)this.Element).NotifyItemClicked(null, null, item.Item, item.Container?.View); //} public void Bind( ListViewSource source) { this._nativeListView.Bind(source); }