Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class MyView : MvxViewController{
- // other stuff
- public override void ViewWillAppear (bool animated)
- {
- var sourceOne = new MyCollectionViewSource (MyCollectionView, new NSString ("MyCollectionViewCell"));
- MyCollectionView.Source = sourceOne;
- var bindings = this.CreateBindingSet<MyView, MyViewModel> ();
- bindings.Bind (sourceOne)
- .To (vm => vm.ItemList);
- bindings.Apply ();
- MyCollectionView.ReloadData ();
- }
- }
- public MyCollectionViewSource : MvxCollectionViewSource{
- protected override UICollectionViewCell GetOrCreateCellFor (UICollectionView collectionView, NSIndexPath indexPath, object item)
- {
- return collectionView.DequeueReusableCell (new NSString ("MyCollectionViewCell"), indexPath) as MyCollectionViewCell;
- }
- public override void WillDisplayCell (UICollectionView collectionView, UICollectionViewCell cell, NSIndexPath indexPath)
- {
- var cellz = cell as MyCollectionViewCell;
- cellz.ClearAllBindings ();
- cellz.BindUrl ();
- }
- }
- public partial class MyCollectionViewCell : MvxCollectionViewCell {
- public MyCollectionViewCell (IntPtr handle) : base (handle)
- {
- BindUrl();
- }
- public void BindUrl()
- {
- this.ClearAllBindings ();
- this.DelayBind(() => {
- this.CreateBinding(MyWebView)
- .For(webView => webView.MyUrl)
- .To<ListItemViewModel>(vm => vm.UrlEntryPoint)
- .Apply();
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement