Example #1
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            this.dataSource.LoadDataFromJSONResource("ListViewSampleData", "json", "players");

            this.label.Frame            = new CGRect(0, this.View.Bounds.Height - 44, this.View.Bounds.Size.Width, 44);
            this.label.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleTopMargin;
            this.label.TextAlignment    = UITextAlignment.Center;
            this.View.AddSubview(this.label);

            this.listView.Frame                   = new CGRect(0, 0, this.View.Bounds.Size.Width, this.View.Bounds.Size.Height - 55);
            this.listView.AutoresizingMask        = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
            this.listView.Delegate                = new ListViewDelegate(this);
            this.listView.WeakDataSource          = this.dataSource;
            this.listView.SelectionBehavior       = TKListViewSelectionBehavior.Press;
            this.listView.AllowsMultipleSelection = true;
            this.View.AddSubview(this.listView);

            TKListViewLinearLayout layout = new TKListViewLinearLayout();

            layout.ItemAlignment = TKListViewItemAlignment.Stretch;
            layout.ItemSpacing   = 0;

            NSIndexPath indexPath = NSIndexPath.FromRowSection(1, 0);

            this.listView.SelectItem(indexPath, false, UICollectionViewScrollPosition.None);
        }
        public override void ViewDidLoad()
        {
            this.AddOption ("Selection on press", SelectionOnPressSelected, "Selection type");
            this.AddOption ("Selection on hold", SelectionOnHoldSelected, "Selection type");
            this.AddOption ("No selection", NoSelectionSelected, "Selection type");
            this.AddOption ("YES", MultipleSelectionSelected, "Multiple selection");
            this.AddOption ("NO", SingleSelectionSelected, "Multiple selection");

            base.ViewDidLoad ();

            this.dataSource.LoadDataFromJSONResource ("ListViewSampleData", "json", "players");

            this.label.Frame = new CGRect (0, this.View.Bounds.Height - 44, this.View.Bounds.Size.Width, 44);
            this.label.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleTopMargin;
            this.label.TextAlignment = UITextAlignment.Center;
            this.View.AddSubview (this.label);

            this.listViewDelegage = new ListViewDelegate (this);

            this.listView.Frame = new CGRect (0, 0, this.View.Bounds.Size.Width, this.View.Bounds.Size.Height - 55);
            this.listView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
            this.listView.Delegate = this.listViewDelegage;
            this.listView.WeakDataSource = this.dataSource;
            this.listView.SelectionBehavior = TKListViewSelectionBehavior.Press;
            this.listView.AllowsMultipleSelection = true;
            this.View.AddSubview (this.listView);

            TKListViewLinearLayout layout = new TKListViewLinearLayout ();
            layout.ItemAlignment = TKListViewItemAlignment.Stretch;
            layout.ItemSpacing = 0;

            NSIndexPath indexPath = NSIndexPath.FromRowSection (1, 0);
            this.listView.SelectItem (indexPath, false, UICollectionViewScrollPosition.None);
        }
Example #3
0
        public override void ViewDidLoad()
        {
            this.AddOption("Manual", "Load on demand mode", LoadOnDemandManual);
            this.AddOption("Auto", "Load on demand mode", LoadOnDemandAuto);

            base.ViewDidLoad();

            this.photos.LoadDataFromJSONResource("PhotosWithNames", "json", "photos");
            this.names.LoadDataFromJSONResource("PhotosWithNames", "json", "names");

            this.listViewDataSource = new ListViewDataSource(this);
            this.listViewDelegate   = new ListViewDelegate(this);

            listView.Frame                  = this.View.Bounds;
            listView.BackgroundColor        = new UIColor(0.0f, 1.0f, 0.0f, 0.5f);
            listView.AutoresizingMask       = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth;
            listView.Delegate               = this.listViewDelegate;
            listView.DataSource             = this.listViewDataSource;
            listView.LoadOnDemandBufferSize = 5;
            listView.LoadOnDemandMode       = TKListViewLoadOnDemandMode.Manual;
            listView.ContentInset           = new UIEdgeInsets(10, 10, 10, 10);
            this.View.AddSubview(listView);
            listView.RegisterClassForCell(new ObjCRuntime.Class(typeof(CustomCardListViewCell)), "cell");

            TKListViewLinearLayout layout = (TKListViewLinearLayout)listView.Layout;

            layout.ItemSize      = new CGSize(100, 120);
            layout.ItemSpacing   = 5;
            layout.ItemAlignment = TKListViewItemAlignment.Stretch;
        }
Example #4
0
        void SlideInSelected()
        {
            TKListViewLinearLayout layout = (TKListViewLinearLayout)this.listView.Layout;

            layout.ItemAppearAnimation = TKListViewItemAnimation.Slide;
            layout.ItemInsertAnimation = TKListViewItemAnimation.Slide;
            layout.ItemDeleteAnimation = TKListViewItemAnimation.Slide;
        }
Example #5
0
 public override CGSize SizeForItem(TKListView listView, TKListViewLinearLayout layout, NSIndexPath indexPath)
 {
     if (layout.ScrollDirection == TKListViewScrollDirection.Vertical)
     {
         return(new CGSize(100, sizes[indexPath.Row]));
     }
     else
     {
         return(new CGSize(sizes[indexPath.Row], 100));
     }
 }
Example #6
0
        void LinearLayoutSelected(object sender, EventArgs e)
        {
            TKListViewLinearLayout layout = new TKListViewLinearLayout();

            layout.ItemSize            = new CGSize(200, 200);
            layout.HeaderReferenceSize = new CGSize(100, 30);
            layout.ItemSpacing         = 1;
            layout.ScrollDirection     = this.scrollDirection;
            this.listView.Layout       = layout;
            this.SetSelectedOptionInSection(1, 1);
        }
Example #7
0
        void LinearLayoutSelected()
        {
            // >> listview-linear-cs
            TKListViewLinearLayout layout = new TKListViewLinearLayout();

            layout.ItemSize            = new CGSize(200, 200);
            layout.HeaderReferenceSize = new CGSize(100, 30);
            layout.ItemSpacing         = 1;
            layout.ScrollDirection     = this.scrollDirection;
            this.listView.Layout       = layout;
            this.SetSelectedOption(1, 1);
            // << listview-linear-cs
        }
Example #8
0
        void CreateListView()
        {
            var list = new TKListView(this.View.Bounds);

            list.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
            list.RegisterClassForCell(new ObjCRuntime.Class(typeof(ListViewVariableSizeCell)), "cell");
            this.View.AddSubview(list);

            TKListViewLinearLayout layout = (TKListViewLinearLayout)list.Layout;

            layout.DynamicItemSize = true;

            list.WeakDataSource = new ListViewDataSource();
        }
Example #9
0
        void ScaleInSelected()
        {
            TKListViewLinearLayout layout = (TKListViewLinearLayout)this.listView.Layout;

            // >> listview-appear-cs
            layout.ItemAppearAnimation = TKListViewItemAnimation.Scale;
            // << listview-appear-cs

            // >> listview-insert-cs
            layout.ItemInsertAnimation = TKListViewItemAnimation.Scale;
            // << listview-insert-cs

            // >> listview-delete-cs
            layout.ItemDeleteAnimation = TKListViewItemAnimation.Slide;
            // << listview-delete-cs
        }
Example #10
0
        public override void ViewDidLoad()
        {
            this.AddOption("Selection on press", "Selection type", SelectionOnPressSelected);
            this.AddOption("Selection on hold", "Selection type", SelectionOnHoldSelected);
            this.AddOption("No selection", "Selection type", NoSelectionSelected);
            this.AddOption("YES", "Multiple selection", MultipleSelectionSelected);
            this.AddOption("NO", "Multiple selection", SingleSelectionSelected);

            base.ViewDidLoad();

            this.dataSource.LoadDataFromJSONResource("ListViewSampleData", "json", "players");

            this.label.Frame            = new CGRect(0, this.View.Bounds.Height - 44, this.View.Bounds.Size.Width, 44);
            this.label.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleTopMargin;
            this.label.TextAlignment    = UITextAlignment.Center;
            this.View.AddSubview(this.label);

            this.listViewDelegage = new ListViewDelegate(this);

            this.listView.Frame            = new CGRect(0, 0, this.View.Bounds.Size.Width, this.View.Bounds.Size.Height - 55);
            this.listView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
            this.listView.Delegate         = this.listViewDelegage;
            this.listView.WeakDataSource   = this.dataSource;

            // >> listview-selection-behavior-cs
            this.listView.SelectionBehavior = TKListViewSelectionBehavior.Press;
            // << listview-selection-behavior-cs

            // >> listview-multiple-selection-cs
            this.listView.AllowsMultipleSelection = true;
            // << listview-multiple-selection-cs

            this.View.AddSubview(this.listView);

            TKListViewLinearLayout layout = new TKListViewLinearLayout();

            layout.ItemAlignment = TKListViewItemAlignment.Stretch;
            layout.ItemSpacing   = 0;

            // >> listview-selection-programatically-cs
            NSIndexPath indexPath = NSIndexPath.FromRowSection(1, 0);

            this.listView.SelectItem(indexPath, false, UICollectionViewScrollPosition.None);
            // << listview-selection-programatically-cs
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            groups = new NSMutableArray();
            groups.Add(NSArray.FromStrings(new string[] { "John", "Abby" }));
            groups.Add(NSArray.FromStrings(new string[] { "Smith", "Peter", "Paula" }));

            TKListView listView = new TKListView(new CGRect(20, 20, this.View.Bounds.Size.Width - 40, this.View.Bounds.Size.Height - 40));

            listView.RegisterClassForCell(new Class(typeof(TKListViewCell)), "cell");

            listView.RegisterClassForSupplementaryView(new Class(typeof(TKListViewHeaderCell)), TKListViewElementKindSectionKey.Header, new NSString("header"));
            listView.DataSource = new ListViewDataSource(this);
            TKListViewLinearLayout layout = (TKListViewLinearLayout)listView.Layout;

            layout.HeaderReferenceSize = new CGSize(200, 22);

            this.View.AddSubview(listView);
        }
Example #12
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            this.dataSource.LoadDataFromJSONResource("ListViewSampleData", "json", "teams");
            this.dataSource.GroupItemSourceKey = "items";
            this.dataSource.GroupWithKey("key");

            TKListView listView = new TKListView(this.View.Bounds);

            listView.AutoresizingMask  = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
            listView.WeakDataSource    = dataSource;
            listView.SelectionBehavior = TKListViewSelectionBehavior.Press;
            this.View.AddSubview(listView);

            // >> listview-layout-cs
            TKListViewLinearLayout layout = (TKListViewLinearLayout)listView.Layout;

            // << listview-layout-cs
            layout.ItemSize            = new CGSize(300, 44);
            layout.HeaderReferenceSize = new CGSize(100, 44);
            layout.FooterReferenceSize = new CGSize(100, 44);

            this.dataSource.Settings.ListView.InitCell(delegate(TKListView list, NSIndexPath indexPath, TKListViewCell cell, NSObject item) {
                TKDataSourceGroup group = this.dataSource.Items[indexPath.Section] as TKDataSourceGroup;
                cell.TextLabel.Text     = group.Items[indexPath.Row] as NSString;
            });

            this.dataSource.Settings.ListView.InitHeader(delegate(TKListView list, NSIndexPath indexPath, TKListViewHeaderCell headerCell, TKDataSourceGroup group) {
                headerCell.TextLabel.Text          = String.Format("{0}", group.Key);
                headerCell.TextLabel.TextAlignment = UITextAlignment.Center;
            });

            this.dataSource.Settings.ListView.InitFooter(delegate(TKListView list, NSIndexPath indexPath, TKListViewFooterCell footerCell, TKDataSourceGroup group) {
                footerCell.TextLabel.Text          = String.Format("Members count: {0}", group.Items.Length);
                footerCell.TextLabel.TextAlignment = UITextAlignment.Left;
                footerCell.TextLabel.Frame         = new CGRect(5, 10, 200, 22);
            });
        }
Example #13
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();

            this.dataSource.LoadDataFromJSONResource ("ListViewSampleData", "json", "teams");
            this.dataSource.GroupItemSourceKey = "items";
            this.dataSource.GroupWithKey ("key");

            TKListView listView = new TKListView (this.View.Bounds);
            listView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
            listView.WeakDataSource = dataSource;
            listView.SelectionBehavior = TKListViewSelectionBehavior.Press;
            this.View.AddSubview (listView);

            TKListViewLinearLayout layout = new TKListViewLinearLayout();
            layout.ItemSize = new CGSize (300, 44);
            layout.HeaderReferenceSize = new CGSize (100, 44);
            layout.FooterReferenceSize = new CGSize (100, 44);
            listView.Layout = layout;

            this.dataSource.Settings.ListView.InitCell (delegate (TKListView list, NSIndexPath indexPath, TKListViewCell cell, NSObject item) {
                TKDataSourceGroup group = this.dataSource.Items[indexPath.Section] as TKDataSourceGroup;
                cell.TextLabel.Text = group.Items[indexPath.Row] as NSString;
            });

            this.dataSource.Settings.ListView.InitHeader (delegate (TKListView list, NSIndexPath indexPath, TKListViewHeaderCell headerCell, TKDataSourceGroup group) {
                headerCell.TextLabel.Text = String.Format("{0}", group.Key);
                headerCell.TextLabel.TextAlignment = UITextAlignment.Center;
            });

            this.dataSource.Settings.ListView.InitFooter (delegate (TKListView list, NSIndexPath indexPath, TKListViewFooterCell footerCell, TKDataSourceGroup group) {
                footerCell.TextLabel.Text = String.Format("Members count: {0}", group.Items.Length);
                footerCell.TextLabel.TextAlignment = UITextAlignment.Left;
                footerCell.TextLabel.Frame = new CGRect(5, 10, 200, 22);
            });
        }
Example #14
0
        void FadeInSelected()
        {
            TKListViewLinearLayout layout = (TKListViewLinearLayout)this.listView.Layout;

            layout.ItemAppearAnimation = TKListViewItemAnimation.Fade;
        }
Example #15
0
 public override CGSize SizeForItem(TKListView listView, TKListViewLinearLayout layout, NSIndexPath indexPath)
 {
     if (layout.ScrollDirection == TKListViewScrollDirection.Vertical) {
         return new CGSize(100, sizes[indexPath.Row]);
     }
     else {
         return new CGSize(sizes[indexPath.Row], 100);
     }
 }
Example #16
0
 void LinearLayoutSelected()
 {
     TKListViewLinearLayout layout = new TKListViewLinearLayout ();
     layout.ItemSize = new CGSize(200, 200);
     layout.HeaderReferenceSize = new CGSize(100, 30);
     layout.ItemSpacing = 1;
     layout.ScrollDirection = this.scrollDirection;
     this.listView.Layout = layout;
     this.SetSelectedOption (1, 1);
 }
Example #17
0
        public override void ViewDidLoad()
        {
            this.AddOption("YES", "Animate buttons", EnableButtonAnimation);
            this.AddOption("NO", "Animate buttons", DisableButtonAnimation);

            base.ViewDidLoad();

            buttonAnimationEnabled = true;
            NSMutableDictionary mails = new NSMutableDictionary();

            mails.Add(new NSString("Joyce Dean"), new NSString("Sales report for January"));
            mails.Add(new NSString("Joel Robertson"), new NSString("Planned network mainternance"));
            mails.Add(new NSString("Sherman Martin"), new NSString("IT help desk"));
            mails.Add(new NSString("Lela Richardson"), new NSString("Summaries of my interviews with customers"));
            mails.Add(new NSString("Jackie Maldonado"), new NSString("REMAINDER: corporate meeting"));
            mails.Add(new NSString("Kathryn Byrd"), new NSString("Stock options"));
            mails.Add(new NSString("Ervin Powers"), new NSString("Thank you!"));
            mails.Add(new NSString("Leland Warner"), new NSString("Meeting with Jack"));
            mails.Add(new NSString("Nicholas Bowers"), new NSString("Please share these articles"));
            mails.Add(new NSString("Alex Soto"), new NSString("Additional information for Jack"));
            mails.Add(new NSString("Naomi Carson"), new NSString("Miss you!"));
            mails.Add(new NSString("Lela Richardson"), new NSString("Summaries of my interviews with customers"));
            mails.Add(new NSString("Rufus Edwards"), new NSString("Training"));
            mails.Add(new NSString("Kathryn Byrd"), new NSString("Stock options"));
            mails.Add(new NSString("Ian Ellis"), new NSString("Do you like this blog article?"));
            mails.Add(new NSString("Pat Vasquez"), new NSString("The latest UI design"));
            mails.Add(new NSString("Chelsea Burton"), new NSString("Need this article!"));
            mails.Add(new NSString("Karl Bates"), new NSString("Training update"));
            mails.Add(new NSString("Evan Rivera"), new NSString("Safety instructions"));
            mails.Add(new NSString("Tony Lawson"), new NSString("Missed our converstation"));
            mails.Add(new NSString("Wallace Little"), new NSString("Swift is awessome"));
            mails.Add(new NSString("Carrie Tran"), new NSString("Missed conference call with Jack"));
            mails.Add(new NSString("Tyler Washington"), new NSString("HR question"));
            mails.Add(new NSString("Dominick Holloway"), new NSString("Wellcome!"));
            mails.Add(new NSString("Clark Sharp"), new NSString("Important question!"));

            this.dataSource.ItemSource = mails;
            this.dataSource.Settings.ListView.CreateCell(delegate(TKListView listView, NSIndexPath indexPath, NSObject item) {
                TKListViewCell cell = listView.DequeueReusableCell("defaultCell", indexPath) as TKListViewCell;
                // >> listview-swipe-view-cs
                if (cell.SwipeBackgroundView.Subviews.Length == 0)
                {
                    CGSize size    = cell.Frame.Size;
                    UIFont font    = UIFont.SystemFontOfSize(14);
                    UIButton bMore = new UIButton(new CGRect(size.Width - 180, 0, 60, size.Height));
                    bMore.SetTitle("More", UIControlState.Normal);
                    bMore.BackgroundColor = UIColor.LightGray;
                    bMore.TitleLabel.Font = font;
                    bMore.AddTarget(ButtonTouched, UIControlEvent.TouchUpInside);
                    cell.SwipeBackgroundView.AddSubview(bMore);

                    UIButton bFlag = new UIButton(new CGRect(size.Width - 120, 0, 60, size.Height));
                    bFlag.SetTitle("Flag", UIControlState.Normal);
                    bFlag.BackgroundColor = UIColor.Orange;
                    bFlag.TitleLabel.Font = font;
                    bFlag.AddTarget(ButtonTouched, UIControlEvent.TouchUpInside);
                    cell.SwipeBackgroundView.AddSubview(bFlag);

                    UIButton bTrash = new UIButton(new CGRect(size.Width - 60, 0, 60, size.Height));
                    bTrash.SetTitle("Trash", UIControlState.Normal);
                    bTrash.BackgroundColor = UIColor.Red;
                    bTrash.TitleLabel.Font = font;
                    bTrash.AddTarget(ButtonTouched, UIControlEvent.TouchUpInside);
                    cell.SwipeBackgroundView.AddSubview(bTrash);

                    UIButton bUnread = new UIButton(new CGRect(0, 0, 60, size.Height));
                    bUnread.SetTitle("Mark as Unread", UIControlState.Normal);
                    bUnread.BackgroundColor          = UIColor.Blue;
                    bUnread.TitleLabel.Font          = font;
                    bUnread.TitleLabel.LineBreakMode = UILineBreakMode.WordWrap;
                    bUnread.TitleLabel.TextAlignment = UITextAlignment.Center;
                    bUnread.AddTarget(ButtonTouched, UIControlEvent.TouchUpInside);
                    cell.SwipeBackgroundView.AddSubview(bUnread);
                }
                // << listview-swipe-view-cs

                return(cell);
            });

            this.dataSource.Settings.ListView.InitCell(delegate(TKListView listView, NSIndexPath indexPath, TKListViewCell cell, NSObject item) {
                cell.TextLabel.Text = item as NSString;
                NSDictionary dict   = this.dataSource.ItemSource as NSDictionary;
                cell.DetailTextLabel.AttributedText = this.AttributedMailText(dict[item] as NSString);
                cell.ContentInsets = new UIEdgeInsets(5, 10, 5, 10);
            });

            this.listViewDelegate = new ListViewDelegate(this);

            this.listView.Frame            = this.View.Bounds;
            this.listView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
            this.listView.WeakDataSource   = this.dataSource;
            this.listView.Delegate         = this.listViewDelegate;

            // >> listview-swipe-cs
            this.listView.AllowsCellSwipe = true;
            // << listview-swipe-cs

            // >> listview-swipe-limits-cs
            this.listView.CellSwipeLimits = new UIEdgeInsets(0, 60, 0, 180);
            // << listview-swipe-limits-cs

            // >> listview-swipe-treshold-cs
            this.listView.CellSwipeTreshold = 30;
            // << listview-swipe-treshold-cs

            this.View.AddSubview(this.listView);

            TKListViewLinearLayout layout = (TKListViewLinearLayout)this.listView.Layout;

            layout.ItemSize = new CGSize(100, 80);
        }
Example #18
0
        void SlideInSelected(object sender, EventArgs e)
        {
            TKListViewLinearLayout layout = (TKListViewLinearLayout)this.listView.Layout;

            layout.ItemAppearAnimation = TKListViewItemAnimation.Slide;
        }