public override void ViewDidLoad() { base.ViewDidLoad(); this.Photos = new TKDataSource("PhotosWithNames", "json", "photos"); this.Names = new TKDataSource("PhotosWithNames", "json", "names"); this.listViewDataSource = new ListViewDataSource(this); TKListView listView = new TKListView(this.View.Bounds); listView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight; listView.DataSource = this.listViewDataSource; this.View.AddSubview(listView); listView.RegisterClassForCell(new Class(typeof(ImageWithTextListViewCell)), "cell"); TKListViewGridLayout layout = new TKListViewGridLayout(); layout.ItemAlignment = TKListViewItemAlignment.Center; layout.SpanCount = 2; layout.ItemSize = new CGSize(150, 200); layout.LineSpacing = 60; layout.ItemSpacing = 10; listView.Layout = layout; TKView view = new TKView(); view.Fill = TKLinearGradientFill.WithColors(new UIColor[] { new UIColor(0.35f, 0.68f, 0.89f, 0.89f), new UIColor(0.35f, 0.68f, 1.0f, 1.0f), new UIColor(0.85f, 0.8f, 0.2f, 0.8f) }); listView.BackgroundView = view; }
public override TKChartPaletteItem PaletteItemForSeries(TKChart chart, TKChartSeries series, nint index) { TKChartPaletteItem item = null; if (series.Index == 1) { UIColor[] colors = new UIColor[] { new UIColor(0f, 1f, 0f, 0.4f), new UIColor(1f, 0f, 0f, 0.4f), new UIColor(0f, 0f, 1f, 0.4f), }; TKLinearGradientFill gradient = new TKLinearGradientFill(colors, new PointF(0.5f, 0.0f), new PointF(0.5f, 1.0f)); item = new TKChartPaletteItem(gradient); } else { TKImageFill image = new TKImageFill(new UIImage("pattern1.png"), 5.0f); image.ResizingMode = TKImageFillResizingMode.Tile; TKStroke stroke = new TKStroke(UIColor.Black, 1.0f); stroke.CornerRadius = 5.0f; stroke.DashPattern = new NSNumber[] { new NSNumber(2), new NSNumber(2), new NSNumber(5), new NSNumber(2) }; item = new TKChartPaletteItem(new NSObject[] { image, stroke }); } return(item); }
public override void ViewDidLoad() { base.ViewDidLoad(); this.View.BackgroundColor = UIColor.FromRGB(239, 239, 244); TKView view = new TKView(this.View.Bounds); view.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight; view.Fill = TKLinearGradientFill.WithColors(new UIColor[] { new UIColor(0.35f, 0.68f, 0.89f, 0.89f), new UIColor(0.35f, 0.68f, 1.0f, 1.0f), new UIColor(0.85f, 0.8f, 0.2f, 0.8f) }); this.View.AddSubview(view); this.Autocomplete = new TKAutoCompleteTextView(new CGRect(10, this.View.Bounds.Y + 10, this.View.Bounds.Size.Width - 20, 35)); this.Autocomplete.SuggestionViewOutOfFrame = true; this.AutomaticallyAdjustsScrollViewInsets = false; this.Datasource = new TKDataSource(); this.Datasource.LoadDataFromJSONResource("namesPhotos", "json", "data"); this.Datasource.Settings.AutoComplete.CreateToken(delegate(nuint index, NSObject item) { TKAutoCompleteToken token = new TKAutoCompleteToken((NSString)(item.ValueForKey(new NSString("name")))); token.Image = UIImage.FromBundle((NSString)item.ValueForKey(new NSString("photo"))); return(token); }); TKListView listView = (TKListView)this.Autocomplete.WeakSuggestionView; listView.BackgroundColor = UIColor.Clear; listView.Frame = new CGRect(10, this.View.Bounds.Y + 15 + this.Autocomplete.Bounds.Height, this.View.Bounds.Size.Width - 20, this.View.Bounds.Height - (15 + this.Autocomplete.Bounds.Height)); listView.RemoveFromSuperview(); listView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight; this.View.AddSubview(listView); listView.RegisterClassForCell(new Class(typeof(ImageWithTextListViewCell)), "cell"); TKListViewGridLayout layout = new TKListViewGridLayout(); layout.ItemAlignment = TKListViewItemAlignment.Center; layout.SpanCount = 2; layout.ItemSize = new CGSize(150, 200); layout.LineSpacing = 60; layout.ItemSpacing = 10; listView.Layout = layout; this.Autocomplete.SuggestMode = TKAutoCompleteSuggestMode.SuggestAppend; this.Autocomplete.AutoresizingMask = UIViewAutoresizing.FlexibleWidth; this.Autocomplete.MaximumWrapHeight = 80; this.Autocomplete.WeakDataSource = this.Datasource; this.Autocomplete.TextField.Placeholder = "Enter Users"; this.Autocomplete.NoResultsLabel.Text = "No Users Found"; this.Autocomplete.CloseButton.SetImage(UIImage.FromBundle("clear.png"), UIControlState.Normal); this.Autocomplete.ImageView.Image = UIImage.FromBundle(new NSString("search.png")); this.Autocomplete.BackgroundColor = UIColor.White; this.Autocomplete.WeakDelegate = autocompleteDelegate; this.Autocomplete.ShowAllItemsInitially = true; this.View.AddSubview(this.Autocomplete); }
void snippet13() { // >> chart-drawing-stroke-gradient-cs var fill = new TKLinearGradientFill(new UIColor[] { new UIColor(0.0f, 1.0f, 0.0f, 0.6f), new UIColor(1.0f, 0.0f, 0.0f, 0.6f), new UIColor(0.0f, 0.0f, 1.0f, 0.6f) }, new CGPoint(0, 0), new CGPoint(1, 1)); var stroke = new TKStroke(fill, 1.0f); stroke.CornerRadius = 5.0f; // << chart-drawing-stroke-gradient-cs }
void snippet4() { // >> chart-drawing-gradient-cs var fill = new TKLinearGradientFill(new UIColor[] { new UIColor(0.0f, 1.0f, 0.0f, 0.6f), new UIColor(1.0f, 0.0f, 0.0f, 0.6f), new UIColor(0.0f, 0.0f, 1.0f, 0.6f) }, new CGPoint(0, 0), new CGPoint(1, 1)); // << chart-drawing-gradient-cs Console.WriteLine(fill); }
void snippet5() { // >> chart-drawing-gradient-direction-cs var fill = new TKLinearGradientFill(new UIColor[] { new UIColor(0.0f, 1.0f, 0.0f, 0.6f), new UIColor(1.0f, 0.0f, 0.0f, 0.6f), new UIColor(0.0f, 0.0f, 1.0f, 0.6f) }, new NSObject[] { new NSNumber(0.6), new NSNumber(0.8), new NSNumber(1.0) }, new CGPoint(0, 0), new CGPoint(1, 1)); // << chart-drawing-gradient-direction-cs Console.WriteLine(fill); }
void snippet14() { // >> chart-drawing-stroke-combined-cs var fill = new TKLinearGradientFill(new UIColor[] { new UIColor(0.0f, 1.0f, 0.0f, 0.6f), new UIColor(1.0f, 0.0f, 0.0f, 0.6f), new UIColor(0.0f, 0.0f, 1.0f, 0.6f) }, new CGPoint(0, 0), new CGPoint(1, 1)); var stroke = new TKStroke(fill, 1.0f); stroke.CornerRadius = 5.0f; stroke.DashPattern = new NSNumber[] { new NSNumber(2), new NSNumber(2), new NSNumber(5), new NSNumber(2) }; stroke.Corners = UIRectCorner.TopRight | UIRectCorner.BottomLeft; // << chart-drawing-stroke-combined-cs }
public override TKChartPaletteItem PaletteItemForSeries(TKChart chart, TKChartSeries series, nint index) { TKChartPaletteItem item = null; if (series.Index == 1) { UIColor[] colors = new UIColor[] { new UIColor(0f, 1f, 0f, 0.4f), new UIColor(1f, 0f, 0f, 0.4f), new UIColor(0f, 0f, 1f, 0.4f), }; TKLinearGradientFill gradient = new TKLinearGradientFill(colors, new PointF (0.5f, 0.0f), new PointF (0.5f, 1.0f)); item = new TKChartPaletteItem (gradient); } else { TKImageFill image = new TKImageFill(new UIImage ("pattern1.png"), 5.0f); image.ResizingMode = TKImageFillResizingMode.Tile; TKStroke stroke = new TKStroke (UIColor.Black, 1.0f); stroke.CornerRadius = 5.0f; stroke.DashPattern = new NSNumber[] { new NSNumber(2), new NSNumber(2), new NSNumber(5), new NSNumber(2) }; item = new TKChartPaletteItem (new NSObject[] { image, stroke }); } return item; }