public TrendsChartSettingsView(TrendsChartSettingsService trendsChartSettingsService) { _trendsChartSettingsService = trendsChartSettingsService; const double cornerRadius = 5; var trendsChartSettingsLabel = new Label { Text = "Default Charts", FontAttributes = FontAttributes.Bold, FontSize = 18, VerticalTextAlignment = TextAlignment.Center }; trendsChartSettingsLabel.SetDynamicResource(Label.TextColorProperty, nameof(BaseTheme.TrendsChartSettingsLabelTextColor)); var selectionIndicatorSettings = new SelectionIndicatorSettings { CornerRadius = cornerRadius }; selectionIndicatorSettings.SetDynamicResource(SelectionIndicatorSettings.ColorProperty, nameof(BaseTheme.TrendsChartSettingsSelectionIndicatorColor)); var trendsChartSettingControl = new SfSegmentedControl { ItemsSource = _trendsChartOptions.Values.ToList(), VisibleSegmentsCount = _trendsChartOptions.Values.Count, CornerRadius = cornerRadius, SelectedIndex = (int)_trendsChartSettingsService.CurrentTrendsChartOption, SelectionIndicatorSettings = selectionIndicatorSettings }; trendsChartSettingControl.SetDynamicResource(SfSegmentedControl.BorderColorProperty, nameof(BaseTheme.TrendsChartSettingsBorderColor)); trendsChartSettingControl.SetDynamicResource(SfSegmentedControl.FontColorProperty, nameof(BaseTheme.TrendsChartSettingsFontColor)); trendsChartSettingControl.SelectionChanged += HandleSelectionChanged; var grid = new Grid { RowDefinitions = { new RowDefinition { Height = new GridLength(1, GridUnitType.Star) }, new RowDefinition { Height = new GridLength(1, GridUnitType.Star) } }, ColumnDefinitions = { new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) } } }; grid.Children.Add(trendsChartSettingsLabel, 0, 0); grid.Children.Add(trendsChartSettingControl, 0, 1); Content = grid; }
public override View GetSampleContent(Context con) { mainLayout = new LinearLayout(con); mainLayout.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent); mainLayout.Orientation = Android.Widget.Orientation.Vertical; segmentedIndicatorSettings = new SelectionIndicatorSettings(); colorIndicatorSettings = new SelectionIndicatorSettings(); sizeIndicatorSettings = new SelectionIndicatorSettings(); segmentedView = new SfSegmentedControl(con); colorSegmentView = new SfSegmentedControl(con); sizeSegmentView = new SfSegmentedControl(con); ViewModel = new SegementViewViewModel(con); LinearLayout segementLayout = new LinearLayout(con); segementLayout.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, 120); segementLayout.Orientation = Android.Widget.Orientation.Vertical; segementLayout.SetPadding(20, 0, 20, 0); segmentedView.ItemsSource = ViewModel.ClothTypeCollection; segmentedView.SegmentHeight = 100; segmentedView.CornerRadius = 50; segmentedView.SegmentHeight = 35; segmentedView.VisibleSegmentsCount = 3; segmentedView.SelectedIndex = 0; segmentedView.BorderColor = Color.Rgb(63, 63, 63); segmentedView.SelectionTextColor = Color.Rgb(2, 160, 174); segmentedView.FontColor = Color.DarkGray; segmentedView.SelectionIndicatorSettings = new SelectionIndicatorSettings { Color = Color.Transparent }; segmentedView.SelectionChanged += SegmentedView_SelectionChanged; segementLayout.AddView(segmentedView); Typeface tf = Typeface.CreateFromAsset(con.Assets, "Segmented.ttf"); ClothView = new TextView(con); ClothView.Text = "A"; ClothView.TextSize = 115; ClothView.TextAlignment = TextAlignment.Center; ClothView.Gravity = GravityFlags.Center; ClothView.Typeface = tf; ClothView.SetTextColor(Color.ParseColor("#32318E")); ///PriceSegment LinearLayout priceLAyout = new LinearLayout(con); priceLAyout.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, 150); priceLAyout.Orientation = Android.Widget.Orientation.Vertical; TextView clothText = new TextView(con); clothText.Text = "Best trendy outfits for men."; clothText.TextSize = 12; clothText.SetTextColor(Color.ParseColor("#3F3F3F")); clothText.TextAlignment = TextAlignment.TextStart; clothText.Gravity = GravityFlags.Start; TextView priceText = new TextView(con); priceText.Text = "$300"; priceText.Typeface = Typeface.DefaultBold; priceText.SetTextColor(Color.ParseColor("#3F3F3F")); priceText.TextAlignment = TextAlignment.TextStart; priceText.Gravity = GravityFlags.Start; priceText.TextSize = 12; priceLAyout.SetPadding(20, 0, 0, 0); priceLAyout.AddView(clothText); priceLAyout.AddView(priceText); ///ColorSegment LinearLayout colorSegementLayout = new LinearLayout(con); colorSegementLayout.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, 210); colorSegementLayout.Orientation = Android.Widget.Orientation.Vertical; colorSegementLayout.SetPadding(20, 0, 20, 0); TextView colorText = new TextView(con); colorText.Text = "Color"; colorText.Typeface = Typeface.DefaultBold; colorText.TextSize = 12; colorText.TextAlignment = TextAlignment.TextStart; colorText.Gravity = GravityFlags.Start; TextView colorspaceText = new TextView(con); colorspaceText.SetHeight(10); colorSegmentView.ItemsSource = ViewModel.PrimaryColors; colorSegmentView.CornerRadius = 50; colorSegmentView.SegmentHeight = 50; colorSegmentView.SegmentWidth = 70; colorSegmentView.SetBackgroundColor(Color.Transparent); colorSegmentView.BorderColor = Color.ParseColor("#EEEEEE"); colorSegmentView.FontIconFontColor = Color.Black; colorSegmentView.SelectedIndex = 0; colorSegmentView.FontSize = 12; colorSegmentView.VisibleSegmentsCount = 7; colorSegmentView.SegmentCornerRadius = 15; colorSegmentView.SelectionTextColor = Color.ParseColor("#32318E"); colorSegmentView.DisplayMode = SegmentDisplayMode.Image; colorIndicatorSettings.Color = Color.ParseColor("#EEEEEE"); colorIndicatorSettings.Position = SelectionIndicatorPosition.Fill; colorSegmentView.SelectionIndicatorSettings = colorIndicatorSettings; colorSegmentView.SelectionChanged += ColorSegmentView_SelectionChanged; colorSegmentView.SetGravity(GravityFlags.Center); colorSegementLayout.AddView(colorText); colorSegementLayout.AddView(colorspaceText); colorSegementLayout.AddView(colorSegmentView); ///SizeSegment LinearLayout sizeSegementLayout = new LinearLayout(con); sizeSegementLayout.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, 240); sizeSegementLayout.Orientation = Android.Widget.Orientation.Vertical; sizeSegementLayout.SetPadding(20, 0, 20, 0); TextView sizeText = new TextView(con); sizeText.Text = "Size"; sizeText.Typeface = Typeface.DefaultBold; sizeText.TextSize = 12; sizeText.TextAlignment = TextAlignment.TextStart; sizeText.Gravity = GravityFlags.Start; TextView sizespaceText = new TextView(con); sizespaceText.SetHeight(10); sizeSegmentView.ItemsSource = ViewModel.SizeCollection; sizeSegmentView.SegmentHeight = 100; sizeSegmentView.CornerRadius = 50; sizeSegmentView.BorderColor = Color.ParseColor("#2C7BBC"); sizeSegmentView.SelectionTextColor = Color.White; sizeSegmentView.DisplayMode = SegmentDisplayMode.Text; sizeSegmentView.VisibleSegmentsCount = 5; sizeSegmentView.SegmentHeight = 40; sizeSegmentView.FontSize = 16; sizeSegmentView.SegmentWidth = 40; sizeSegmentView.FontColor = Color.Black; sizeIndicatorSettings.Color = Color.ParseColor("#2C7BBC"); sizeSegmentView.FontIconFontColor = Color.Black; //sizeIndicatorSettings.CornerRadius = 20; sizeIndicatorSettings.Position = SelectionIndicatorPosition.Fill; sizeSegmentView.SelectionIndicatorSettings = sizeIndicatorSettings; sizeSegementLayout.AddView(sizeText); sizeSegementLayout.AddView(sizespaceText); sizeSegementLayout.AddView(sizeSegmentView); ///DesCription LinearLayout desCriptionLayout = new LinearLayout(con); desCriptionLayout.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, 250); desCriptionLayout.Orientation = Android.Widget.Orientation.Vertical; desCriptionLayout.SetPadding(20, 0, 0, 0); TextView descriptionText = new TextView(con); descriptionText.Text = "Description"; descriptionText.Typeface = Typeface.DefaultBold; descriptionText.TextSize = 12; descriptionText.TextAlignment = TextAlignment.TextStart; descriptionText.Gravity = GravityFlags.Start; TextView spaceText = new TextView(con); spaceText.SetHeight(5); TextView detailDescription = new TextView(con); detailDescription.Text = "95 % Polyester, 5 % Spandex, imported, machine wash, casual wear.This outfit keeps you cool and comfortable in quick - dry fabric that wicks away moisture."; detailDescription.TextSize = 12; detailDescription.TextAlignment = TextAlignment.TextStart; detailDescription.Gravity = GravityFlags.Start; desCriptionLayout.AddView(descriptionText); desCriptionLayout.AddView(spaceText); desCriptionLayout.AddView(detailDescription); TextView space = new TextView(con); if (IsTabletDevice(con) == true) { mainLayout.SetPadding(50, 0, 50, 0); descriptionText.TextSize = 16; detailDescription.TextSize = 16; sizeText.TextSize = 16; clothText.TextSize = 16; colorText.TextSize = 16; priceText.TextSize = 16; } if (con.Resources.DisplayMetrics.Density > 3) { segementLayout.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, 120 * 2); priceLAyout.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, 150 * 2); colorSegementLayout.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, 210 * 2); sizeSegementLayout.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, 240 * 2); desCriptionLayout.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, 250 * 2); } mainLayout.AddView(space); mainLayout.AddView(segementLayout); mainLayout.AddView(ClothView); mainLayout.AddView(priceLAyout); mainLayout.AddView(colorSegementLayout); mainLayout.AddView(sizeSegementLayout); mainLayout.AddView(desCriptionLayout); return(mainLayout); }
public SegementViewGettingStarted() { segmentedView = new SfSegmentedControl(); colorSegmentedView = new SfSegmentedControl(); sizeSegmentedView = new SfSegmentedControl(); fontIconText = new UILabel(); AddCollection(); //SegmentedView segmentedView.ItemsSource = ClothTypeCollection; segmentedView.FontColor = UIColor.Black; segmentedView.Font = UIFont.SystemFontOfSize(12); segmentedView.CornerRadius = 20; segmentedView.SegmentHeight = 40; segmentedView.SegmentWidth = 20; segmentedView.BackgroundColor = UIColor.Clear; segmentedView.VisibleSegmentsCount = 3; segmentedView.SelectedIndex = 0; segmentedView.BorderThickness = 1; segmentedView.BorderColor = UIColor.FromRGB(63, 63, 63); segmentedView.SelectionTextColor = UIColor.FromRGB(2, 160, 174); segmentedView.SelectionChanged += SegmentedView_SelectionChanged; segmentedView.SelectionIndicatorSettings = new SelectionIndicatorSettings() { Color = UIColor.Clear, CornerRadius = 20 }; clothTypeLabel = new UILabel(); clothTypeLabel.Text = "A"; clothTypeLabel.TextAlignment = UITextAlignment.Center; clothTypeLabel.Font = UIFont.FromName("Segmented", 115); clothTypeLabel.TextColor = UIColor.FromRGB(0, 141, 127); clothNameLabel = new UILabel(); clothNameLabel.Text = "Best trendy outfits for men."; clothNameLabel.Font = UIFont.SystemFontOfSize(12); clothNameLabel.TextColor = UIColor.FromRGB(63, 63, 63); clothNameLabel.TextAlignment = UITextAlignment.Left; clothPriceLabel = new UILabel(); clothPriceLabel.Text = "$300"; clothPriceLabel.Font = UIFont.FromName("Helvetica-Bold", 10f); colorLabel = new UILabel(); colorLabel.Text = "Color"; colorLabel.Font = UIFont.FromName("Helvetica-Bold", 10f); //ColorSegmentedView colorSegmentedView.ItemsSource = PrimaryColors; colorSegmentedView.CornerRadius = 3; colorSegmentedView.SegmentHeight = 50; colorSegmentedView.SegmentWidth = 20; colorSegmentedView.BorderThickness = 1; colorSegmentedView.BackgroundColor = UIColor.Clear; colorSegmentedView.BorderColor = UIColor.FromRGB(238, 238, 238); colorSegmentedView.SelectedIndex = 6; colorSegmentedView.Font = UIFont.SystemFontOfSize(8); colorSegmentedView.FontIconFontColor = UIColor.Black; colorSegmentedView.SelectionTextColor = UIColor.FromRGB(0, 141, 127); colorSegmentedView.VisibleSegmentsCount = 7; colorSegmentedView.SegmentCornerRadius = 15; colorSegmentedView.DisplayMode = SegmentDisplayMode.Image; colorSegmentedView.SelectionIndicatorSettings = new SelectionIndicatorSettings() { Color = UIColor.FromRGB(238, 238, 238), Position = SelectionIndicatorPosition.Fill }; colorSegmentedView.SelectionChanged += ColorSegmentedView_SelectionChanged; //SizeSegment sizeLabel = new UILabel(); sizeLabel.Text = "Size"; sizeLabel.Font = UIFont.FromName("Helvetica-Bold", 10f); sizeSegmentedView.ItemsSource = SizeCollection; sizeSegmentedView.CornerRadius = 25; sizeSegmentedView.BorderColor = UIColor.Black; sizeSegmentedView.SelectionTextColor = UIColor.White; sizeSegmentedView.DisplayMode = SegmentDisplayMode.Image; sizeSegmentedView.Font = UIFont.SystemFontOfSize(16); sizeSegmentedView.FontIconFontColor = UIColor.Black; sizeSegmentedView.VisibleSegmentsCount = 5; sizeSegmentedView.SegmentHeight = 50; if ((UIDevice.CurrentDevice).UserInterfaceIdiom == UIUserInterfaceIdiom.Pad) { sizeSegmentedView.BorderThickness = 3; } else { sizeSegmentedView.BorderThickness = 1; } sizeSegmentedView.SegmentWidth = 20; sizeSegmentedView.SelectionIndicatorSettings = new SelectionIndicatorSettings() { Color = UIColor.FromRGB(44, 123, 188), Position = SelectionIndicatorPosition.Fill }; //Description Segement descriptionLabel = new UILabel(); descriptionLabel.Text = "Description"; descriptionLabel.Font = UIFont.FromName("Helvetica-Bold", 10f); descriptionText = new UILabel(); descriptionText.Text = "95% Polyester, 5% Spandex, imported, machine wash, casual wear. This outfit keeps you cool and comfortable in quick-dry fabric that wicks away moisture."; descriptionText.Font = UIFont.SystemFontOfSize(10); descriptionText.Lines = 5; if ((UIDevice.CurrentDevice).UserInterfaceIdiom == UIUserInterfaceIdiom.Pad) { clothTypeLabel.Font = UIFont.FromName("Segmented", 250); clothNameLabel.Font = UIFont.SystemFontOfSize(20); clothPriceLabel.Font = UIFont.FromName("Helvetica-Bold", 20f); colorLabel.Font = UIFont.FromName("Helvetica-Bold", 20f); sizeLabel.Font = UIFont.FromName("Helvetica-Bold", 20f); descriptionLabel.Font = UIFont.FromName("Helvetica-Bold", 20f); descriptionText.Font = UIFont.SystemFontOfSize(18); } //Add Views this.AddSubview(segmentedView); this.AddSubview(clothTypeLabel); this.AddSubview(clothNameLabel); this.AddSubview(clothPriceLabel); this.AddSubview(colorLabel); this.AddSubview(colorSegmentedView); this.AddSubview(sizeLabel); this.AddSubview(sizeSegmentedView); this.AddSubview(descriptionLabel); this.AddSubview(descriptionText); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); LinearLayout mainLayout = new LinearLayout(this); mainLayout.Orientation = Orientation.Vertical; mainLayout.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent); mainLayout.SetBackgroundColor(Color.WhiteSmoke); mainLayout.SetPadding(50, 50, 50, 50); //Adding textview as the header part of the application. TextView headerLabel = new TextView(this); headerLabel.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, 100); headerLabel.Text = "Bus Ticket Booking"; headerLabel.SetTextColor(Color.Black); headerLabel.TextSize = 25; headerLabel.TextAlignment = TextAlignment.Center; headerLabel.TextAlignment = TextAlignment.Gravity; //Adding the editor to enter the origin location. EditText fromEditor = new EditText(this); fromEditor.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, 130); fromEditor.Hint = "From"; fromEditor.SetTextColor(Color.Black); fromEditor.SetHintTextColor(Color.Gray); //Adding editor to enter the destination locaiton. EditText toEditor = new EditText(this); toEditor.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, 170); toEditor.Hint = "To"; toEditor.SetTextColor(Color.Black); toEditor.SetHintTextColor(Color.Gray); //segmented control to add item as string data. SfSegmentedControl segmentedControl = new SfSegmentedControl(this) { LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, 200), SelectionTextColor = Color.White, BackColor = Color.Transparent, SegmentHeight = 50, BorderColor = Color.ParseColor("#929292"), FontColor = Color.ParseColor("#929292"), SegmentBackgroundColor = Color.Transparent, VisibleSegmentsCount = 6, DisplayMode = SegmentDisplayMode.Text, ItemsSource = new List <string> { "1", "2", "3", "4", "5", "6" } }; //segmented control to add item as SfSegmentItem. SfSegmentedControl segment = new SfSegmentedControl(this) { SelectionTextColor = Color.White, LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, 200), BorderColor = Color.ParseColor("#007CEE"), FontColor = Color.Black, SelectedIndex = 2, FontSize = 15, SegmentHeight = 50, SegmentBackgroundColor = Color.Transparent, VisibleSegmentsCount = 5, DisplayMode = SegmentDisplayMode.Text, ItemsSource = new ObservableCollection <SfSegmentItem> { new SfSegmentItem() { Text = "Sleepers" }, new SfSegmentItem() { Text = "Seaters" }, }, SelectionIndicatorSettings = new SelectionIndicatorSettings() { Color = Color.Transparent } }; AlertDialog.Builder resultsDialog = new AlertDialog.Builder(this); resultsDialog.SetTitle("Status"); Button resetButtonView = new Button(this) { Text = "Reset", TextAlignment = TextAlignment.Center }; resetButtonView.SetHeight(50); resetButtonView.SetBackgroundColor(Color.White); resetButtonView.SetTextColor(Color.Gray); Button goButtonView = new Button(this) { Text = "Go", TextAlignment = TextAlignment.Center }; goButtonView.SetHeight(50); goButtonView.SetTextColor(Color.Gray); goButtonView.SetBackgroundColor(Color.White); resetButtonView.Click += (object sender, EventArgs e) => { resultsDialog.SetMessage("Fields has been reset."); resultsDialog.Create().Show(); resultsDialog.SetCancelable(true); }; goButtonView.Click += (object sender, EventArgs e) => { resultsDialog.SetMessage("Your ticket has been booked."); resultsDialog.Create().Show(); resultsDialog.SetCancelable(true); }; //segmented control to add item as View. SfSegmentedControl segmentView = new SfSegmentedControl(this) { LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, 200), BorderColor = Color.Transparent, SegmentHeight = 50, VisibleSegmentsCount = 2, SegmentPadding = 30, ItemsSource = new ObservableCollection <View> { resetButtonView, goButtonView }, }; mainLayout.AddView(headerLabel); mainLayout.AddView(fromEditor); mainLayout.AddView(toEditor); mainLayout.AddView(segment); mainLayout.AddView(segmentedControl); mainLayout.AddView(segmentView); // Set our view from the "main" layout resource SetContentView(mainLayout); }