public override void ViewDidLoad() { base.ViewDidLoad(); // Perform any additional setup after loading the view, typically from a nib. //// Initialize SfCalendar calendar = new SFCalendar(); calendar.MonthChanged += Calendar_MonthChanged; calendar.HeaderHeight = 0; calendar.MonthViewSettings.TodaySelectionBackgroundColor = UIColor.FromRGB(137, 82, 83); //// Initialize SfPopUpLayout popupLayout = new SfPopupLayout(); headerContent = new UILabel(); headerContent.TextAlignment = UITextAlignment.Center; headerContent.BackgroundColor = UIColor.FromRGB(137, 82, 83); headerContent.TextColor = UIColor.White; headerContent.Font = UIFont.FromName("Helvetica-Bold", 16); // Adding Header view of the SfPopupLayout popupLayout.PopupView.HeaderView = headerContent; popupLayout.PopupView.ShowCloseButton = false; // Adding Calendar as ContentView of the SfPopupLayout popupLayout.PopupView.ContentView = calendar; clearButton = new UIButton(); clearButton.SetTitle("Clear", UIControlState.Normal); clearButton.SetTitleColor(UIColor.White, UIControlState.Normal); clearButton.BackgroundColor = UIColor.Gray; clearButton.Frame = new CGRect(100, 10, 80, 30); clearButton.Layer.CornerRadius = 10; clearButton.ClipsToBounds = true; okButton = new UIButton(); okButton.SetTitle("Ok", UIControlState.Normal); okButton.SetTitleColor(UIColor.White, UIControlState.Normal); okButton.BackgroundColor = UIColor.Gray; okButton.Frame = new CGRect(190, 10, 80, 30); okButton.Layer.CornerRadius = 10; okButton.ClipsToBounds = true; clearButton.TouchDown += ClearButton_TouchDown; okButton.TouchDown += OkButton_TouchDown; uIStackView = new UIStackView(); uIStackView.Axis = UILayoutConstraintAxis.Horizontal; uIStackView.UserInteractionEnabled = true; uIStackView.Add(clearButton); uIStackView.Add(okButton); // Adding Footer view of the SfPopupLayout popupLayout.PopupView.FooterView = uIStackView; rootView = new UIView(); rootView = GetContentOfPopup(); this.View.AddSubview(rootView); }
private void AddCarouselItems() { AddCarouselContent(); for (int i = 0; i <= 6; i++) { var width = carousel.ItemWidth * 0.6; SfCarouselItem items = new SfCarouselItem(); UIStackView stackView = new UIStackView(); stackView.BackgroundColor = UIColor.White; stackView.Axis = UILayoutConstraintAxis.Horizontal; stackView.Frame = new CGRect(0, 0, carousel.ItemWidth, carousel.ItemHeight); stackView.Layer.CornerRadius = 10; stackView.Layer.BorderColor = UIColor.LightGray.CGColor; stackView.Layer.BorderWidth = 0.5f; UIStackView stackView1 = new UIStackView(); stackView1.Axis = UILayoutConstraintAxis.Vertical; stackView1.Frame = new CGRect(0, 0, width, carousel.ItemHeight); UILabel label1 = new UILabel(); label1.Text = headerList[i]; label1.Font = UIFont.SystemFontOfSize(14, UIFontWeight.Bold); label1.Frame = new CGRect(10, 5, width, carousel.ItemHeight * 0.25); stackView1.Add(label1); UILabel label = new UILabel(); label.Text = descriptionList[i]; label.Font = UIFont.SystemFontOfSize(10, UIFontWeight.Regular); label.Lines = 4; label.ContentMode = UIViewContentMode.TopLeft; label.LineBreakMode = UILineBreakMode.WordWrap | UILineBreakMode.TailTruncation; label.Frame = new CGRect(10, carousel.ItemHeight * 0.25, stackView1.Frame.Width - 10, carousel.ItemHeight * 0.75); stackView1.Add(label); UIImageView uiImageView = new UIImageView(); uiImageView.Image = UIImage.FromBundle(imageList[i]); uiImageView.Frame = new CGRect(width + 8, 10, carousel.ItemWidth * 0.4 - 16, carousel.ItemHeight - 20); uiImageView.Layer.CornerRadius = 7; uiImageView.Layer.BorderColor = UIColor.LightGray.CGColor; uiImageView.ClipsToBounds = true; stackView.Add(stackView1); stackView.Add(uiImageView); items.View = stackView; carouselItems.Add(items); } carousel.DataSource = carouselItems; }
private void Schedule_AppointmentLoaded(object sender, AppointmentLoadedEventArgs e) { if (e.Appointment.Subject == "Checkup") { UIImageView hospitalImage = new UIImageView(); hospitalImage.Image = UIImage.FromFile("Images/Hospital.png"); hospitalImage.Frame = new CGRect(50, 35, 50.0f, 50.0f); UIStackView stackPanel = new UIStackView(); stackPanel.Frame = new CGRect(0, 0, 100, 50); stackPanel.Add(hospitalImage); e.AppointmentStyle.TextStyle = UIFont.FromName(@"Arial", 16); e.AppointmentStyle.TextColor = UIColor.White; e.View = stackPanel; } else { UIImageView familyImage = new UIImageView(); familyImage.Image = UIImage.FromFile("Images/family.png"); familyImage.Frame = new CGRect(50, 35, 50.0f, 30.0f); UIStackView stackPanel = new UIStackView(); stackPanel.Frame = new CGRect(0, 0, 100, 30); stackPanel.Add(familyImage); e.AppointmentStyle.TextStyle = UIFont.FromName(@"Arial", 16); e.AppointmentStyle.TextColor = UIColor.White; e.View = stackPanel; } }
/// <summary> /// Creates thumbnails and subheadings for the timeline scrollview. /// </summary> private void CreateThumbnails() { var xPoint = Constants.XPoint; const int yPoint = Constants.YPoint; _thumbnailStackView = new UIStackView(); _subHeadingStackView = new UIStackView(); foreach (var pair in InputImageEntries.Select((value, index) => new { index, value })) { var thumbnailView = new UIImageView(new CGRect(xPoint, yPoint, Constants.ThumbnailWidth, Constants.ThumbnailHeight)) { Image = pair.value.Image.ToUIImage(), ContentMode = UIViewContentMode.ScaleToFill, UserInteractionEnabled = true, Tag = pair.index }; if (pair.value.CreationTime != null) { var subheadingView = new UITextView(new CGRect(xPoint, Constants.Origin, Constants.ThumbnailWidth, Constants.SubheadingViewHeight)) { Text = pair.value.CreationTime.Value.ToString(Constants.DateTimeFormat, CultureInfo.CurrentCulture), TextColor = Constants.SubheadingTextColour, TextAlignment = Constants.SubheadingTextAlignment, Font = UIFont.GetPreferredFontForTextStyle(UIFontTextStyle.Caption1), AdjustsFontForContentSizeCategory = true, BackgroundColor = Constants.TimeLineScrollViewColour, Editable = false }; SetTimelineSubheaderInsets(subheadingView); _subHeadingStackView.Add(subheadingView); } _thumbnailStackView.Add(thumbnailView); xPoint += Constants.XIncrement; ConfigureInputImageThumbnailAccessibilityAttributes(thumbnailView, pair.value.CreationTime); } _thumbnailStackView.UserInteractionEnabled = true; }
private void CreateLayout() { // Place the map view in the upper half of the display. _myMapView.Frame = new CGRect(0, 0, View.Bounds.Width, _mapViewHeight); // Place the transformations UI in the bottom half. _transformToolsView.Axis = UILayoutConstraintAxis.Vertical; _transformToolsView.Frame = new CGRect(0, _mapViewHeight, View.Bounds.Width, _transformToolsHeight); // View for the input/output WKID labels. UIStackView wkidLabelsStackView = new UIStackView(new CGRect(10, 5, View.Bounds.Width - 10, 35)) { Axis = UILayoutConstraintAxis.Horizontal }; // Create a label for the input spatial reference. _inWkidLabel = new UILabel(new CGRect(5, 0, View.Bounds.Width / 2 - 15, 30)) { Text = "In WKID = ", TextAlignment = UITextAlignment.Left, TextColor = UIColor.Black }; // Create a label for the output spatial reference. _outWkidLabel = new UILabel(new CGRect(View.Bounds.Width / 2 + 5, 0, View.Bounds.Width / 2 - 15, 30)) { Text = "Out WKID = ", TextAlignment = UITextAlignment.Left, TextColor = UIColor.Black }; // Add the WKID labels to the stack view. wkidLabelsStackView.Add(_inWkidLabel); wkidLabelsStackView.Add(_outWkidLabel); // Create a horizontal stack view for the 'use extent' switch and label. UIStackView extentSwitchRow = new UIStackView(new CGRect(20, 35, View.Bounds.Width - 20, 35)) { Axis = UILayoutConstraintAxis.Horizontal }; _useExtentSwitch = new UISwitch { On = false }; _useExtentSwitch.ValueChanged += UseExtentSwitch_ValueChanged; // Create a label for the use extent switch. UILabel useExtentLabel = new UILabel(new CGRect(70, 0, View.Bounds.Width - 70, 30)) { Text = "Use extent", TextAlignment = UITextAlignment.Left, TextColor = UIColor.Black }; // Add the switch and the label to the horizontal stack view. extentSwitchRow.Add(_useExtentSwitch); extentSwitchRow.Add(useExtentLabel); // Create a picker for datum transformations. _transformationsPicker = new UIPickerView(new CGRect(20, 70, View.Bounds.Width - 20, 120)); // Create a text view to show messages. _messagesTextView = new UITextView(new CGRect(20, 200, View.Bounds.Width - 20, 60)); // Add the controls to the transform UI (stack view). _transformToolsView.AddSubviews(wkidLabelsStackView, extentSwitchRow, _transformationsPicker, _messagesTextView); // Add the map view and tools subviews to the view. View.AddSubviews(_myMapView, _transformToolsView); // Set the view background color. View.BackgroundColor = UIColor.White; }
public override void LayoutSubviews() { base.LayoutSubviews(); mainView = new UIView(); mainView.Frame = new CGRect(0, 0, Frame.Width, Frame.Height); UIStackView profileView = new UIStackView(); var height = mainView.Frame.Height * 0.45; profileView.Frame = new CoreGraphics.CGRect(0, 0, mainView.Frame.Width, height); profileView.Axis = UILayoutConstraintAxis.Vertical; CAGradientLayer gradientLayer = new CAGradientLayer(); gradientLayer.Frame = profileView.Frame; gradientLayer.Colors = new CGColor[] { UIColor.FromRGB(171, 233, 247).CGColor, UIColor.FromRGB(0, 113, 138).CGColor }; gradientLayer.StartPoint = new CGPoint(0, 0); gradientLayer.EndPoint = new CGPoint(0, 1); profileView.Layer.AddSublayer(gradientLayer); var height1 = profileView.Frame.Height * 0.25; var height2 = profileView.Frame.Height * 0.5; var height3 = profileView.Frame.Height * 0.25; UILabel label = UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad ? new UILabel(new CGRect(20, 0, profileView.Frame.Width, height1)) : new UILabel(new CGRect(16, 0, profileView.Frame.Width, height1)); label.BackgroundColor = UIColor.Clear; label.Font = UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad ? UIFont.SystemFontOfSize(25) : UIFont.SystemFontOfSize(15); label.TextColor = UIColor.FromRGB(25, 88, 102); label.TextAlignment = UITextAlignment.Left; label.Text = "Profile"; profileView.Add(label); imageView = new UIImageView(); imageView.ContentMode = UIViewContentMode.ScaleAspectFit; imageView.Frame = new CoreGraphics.CGRect(0, label.Frame.Bottom, profileView.Frame.Width, height2); imageView.Image = UIImage.FromBundle("Images/ImageEditor/Profile.png"); profileView.Add(imageView); UIButton button = new UIButton(); button.SetTitle("Edit Image", UIControlState.Normal); var size = imageView.SizeThatFits(CGSize.Empty); if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad) { button.Frame = new CoreGraphics.CGRect(profileView.Frame.Width / 2 - size.Width / 4, imageView.Frame.Bottom + 20, size.Width / 2, height3 / 2); } else { button.Frame = new CoreGraphics.CGRect(profileView.Frame.Width / 2 - size.Width / 8, imageView.Frame.Bottom + (height3 / 4), (size.Width / 4) + 10, height3 / 2); } button.VerticalAlignment = UIControlContentVerticalAlignment.Center; button.HorizontalAlignment = UIControlContentHorizontalAlignment.Center; button.BackgroundColor = UIColor.Clear; if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad) { button.Font = UIFont.SystemFontOfSize(20); button.Layer.CornerRadius = 20; } else { button.Font = UIFont.SystemFontOfSize(14); button.Layer.CornerRadius = 13; } button.Layer.BorderColor = UIColor.White.CGColor; button.Layer.BorderWidth = 2; button.SetTitleColor(UIColor.White, UIControlState.Normal); button.TouchDown += (sender, e) => { navigationController.PushViewController(new ProfileViewController(imageView.Image, navigationController, imageView), false); }; profileView.Add(button); mainView.AddSubview(profileView); UIView detailsView = new UIView(); detailsView.Frame = new CGRect(0, profileView.Frame.Bottom, mainView.Frame.Width, mainView.Frame.Height * 0.55); previousTop = 0; for (int i = 0; i < 4; i++) { UIView itemView = CreateView(detailsView, i); detailsView.Add(itemView); } mainView.AddSubview(detailsView); AddSubview(mainView); }
private void CreateLayout() { // Place the map view in the upper two thirds of the display. _mapView.Frame = new CGRect(0, 0, View.Bounds.Width, _mapViewHeight); View.BackgroundColor = UIColor.Gray; // Fit three buttons on the row. double buttonWidth = View.Bounds.Width / 3.0; // Button to start an edit transaction. _startEditingButton.SetTitle("Start", UIControlState.Normal); _startEditingButton.SetTitleColor(UIColor.LightGray, UIControlState.Disabled); _startEditingButton.Frame = new CGRect(0, 0, buttonWidth, 30); _startEditingButton.TouchUpInside += BeginTransaction; // Button to stop a transaction. _stopEditingButton.SetTitle("Stop", UIControlState.Normal); _stopEditingButton.Enabled = false; _stopEditingButton.SetTitleColor(UIColor.LightGray, UIControlState.Disabled); _stopEditingButton.Frame = new CGRect(buttonWidth, 0, buttonWidth, 30); _stopEditingButton.TouchUpInside += StopEditTransaction; // Button to synchronize local edits with the service. _syncEditsButton.SetTitle("Sync", UIControlState.Normal); _syncEditsButton.SetTitleColor(UIColor.LightGray, UIControlState.Disabled); _syncEditsButton.Enabled = false; _syncEditsButton.Frame = new CGRect(buttonWidth * 2, 0, buttonWidth, 30); _syncEditsButton.TouchUpInside += SynchronizeEdits; // Two buttons on this row. buttonWidth = View.Bounds.Width / 2.0; // Button to add bird features. _addBirdButton.SetTitle("Add Bird", UIControlState.Normal); _addBirdButton.Enabled = false; _addBirdButton.SetTitleColor(UIColor.LightGray, UIControlState.Disabled); _addBirdButton.Frame = new CGRect(0, 0, buttonWidth, 30); _addBirdButton.TouchUpInside += AddNewFeature; // Button to add marine features. _addMarineButton.SetTitle("Add Marine", UIControlState.Normal); _addMarineButton.Enabled = false; _addMarineButton.SetTitleColor(UIColor.LightGray, UIControlState.Disabled); _addMarineButton.Frame = new CGRect(buttonWidth, 0, buttonWidth, 30); _addMarineButton.TouchUpInside += AddNewFeature; _editToolsView.Axis = UILayoutConstraintAxis.Vertical; _editToolsView.Frame = new CGRect(0, _mapViewHeight, View.Bounds.Width, _editToolsHeight); // View to hold the first row of buttons (start, stop, sync). UIStackView editButtonsRow1 = new UIStackView { Frame = new CGRect(0, 0, View.Bounds.Width, 35), Axis = UILayoutConstraintAxis.Horizontal }; editButtonsRow1.Add(_startEditingButton); editButtonsRow1.Add(_stopEditingButton); editButtonsRow1.Add(_syncEditsButton); // View to hold the second row of buttons (add bird, add marine). UIStackView editButtonsRow2 = new UIStackView { Frame = new CGRect(0, 35, View.Bounds.Width, 35), Axis = UILayoutConstraintAxis.Horizontal }; editButtonsRow2.Add(_addBirdButton); editButtonsRow2.Add(_addMarineButton); // View for the 'require transaction' switch. UIStackView editSwitchRow = new UIStackView { Frame = new CGRect(0, 70, View.Bounds.Width, 35), Axis = UILayoutConstraintAxis.Horizontal }; _requireTransactionSwitch.On = true; _requireTransactionSwitch.ValueChanged += RequireTransactionChanged; editSwitchRow.Add(_requireTransactionSwitch); // Create a label that describes the switch value. UILabel switchLabel = new UILabel { Text = "Require transaction", Frame = new CGRect(70, 0, View.Bounds.Width - 70, 30) }; editSwitchRow.Add(switchLabel); // Progress bar. _progressBar.Frame = new CGRect(0, 105, View.Bounds.Width, 10); // Use the rest of the view to show status messages. _messageTextBlock.Editable = false; _messageTextBlock.Frame = new CGRect(0, 115, View.Bounds.Width, _editToolsHeight); // Add the first row of buttons. _editToolsView.Add(editButtonsRow1); // Add the second row of buttons. _editToolsView.Add(editButtonsRow2); // Add the 'require transaction' switch and label. _editToolsView.Add(editSwitchRow); // Add the messages text view. _editToolsView.Add(_messageTextBlock); // Add the progress bar. _editToolsView.Add(_progressBar); // Add the views. View.AddSubviews(_mapView, _editToolsView); }