public TitleBarView() { //Spacing = 0; //Padding=new Thickness(10,0); Padding = new Thickness(10, 10); BackgroundColor = Color.White; //Color.FromHex("#f7f7f7"); Orientation = StackOrientation.Vertical; textLabel = new Label(); textLabel.BindingContext = this; lineView = new LineView() { HorizontalOptions = LayoutOptions.FillAndExpand }; lineView.BindingContext = this; textLabel.SetBinding(Label.TextProperty,"Text"); textLabel.SetBinding(Label.TextColorProperty, "TextColor"); textLabel.SetBinding(Label.FontAttributesProperty, "FontAttributes"); textLabel.SetBinding(Label.FontFamilyProperty, "FontFamily"); textLabel.SetBinding(Label.FontSizeProperty, "FontSize"); //lineView.SetBinding(LineView.BackgroundColorProperty, "UnderLineColor"); lineView.BackgroundColor = Color.FromHex("#eee"); lineView.SetBinding(LineView.HeightRequestProperty, "UnderLineHeight"); Children.Add(textLabel); Children.Add(lineView); }
public void TestObservableMergeHeight2() { LineView lv = new LineView(); Assert.AreEqual(Color.Black, lv.Color); lv.EndPoint = new Point(11, 11); Assert.AreEqual(11, lv.PreferredHeight); }
public void TestObservableMergeWidth1() { LineView lv = new LineView(); Assert.AreEqual(Color.Black, lv.Color); lv.EndPoint = new Point(9, 9); Assert.AreEqual(9, lv.PreferredWidth); }
void ReleaseDesignerOutlets() { if (TableView != null) { TableView.Dispose(); TableView = null; } if (BackgroundImageView != null) { BackgroundImageView.Dispose(); BackgroundImageView = null; } if (DetailLabel != null) { DetailLabel.Dispose(); DetailLabel = null; } if (ImageView != null) { ImageView.Dispose(); ImageView = null; } if (LineView != null) { LineView.Dispose(); LineView = null; } if (MoreButton != null) { MoreButton.Dispose(); MoreButton = null; } if (PlayButton != null) { PlayButton.Dispose(); PlayButton = null; } if (ShuffleButton != null) { ShuffleButton.Dispose(); ShuffleButton = null; } if (TitleLabel != null) { TitleLabel.Dispose(); TitleLabel = null; } }
public LineImpedance CreateLineImpedance(LineView record) { LineImpedance li = new LineImpedance(); li.R0 = record.R0; li.R1 = record.R1; li.X0 = record.X0; li.X1 = record.X1; li.LineID = record.ID; return(li); }
public Lines CreateLines(LineView record) { Lines line = NewLines(); line.AssetKey = record.AssetKey; line.Description = record.Description; line.Length = record.Length; line.ThermalRating = record.ThermalRating; line.VoltageKV = record.VoltageKV; return(line); }
void Start( ) { var pointAsset = Resources.Load("Prefabs/Point Entity") as GameObject; pointPrefab = pointAsset.GetComponent <PointView> ( ); pointPrefab.CreatePool( ); var lineAsset = Resources.Load("Prefabs/Line Entity") as GameObject; linePrefab = lineAsset.GetComponent <LineView> ( ); linePrefab.CreatePool( ); init( ); }
public object GetJson() { List <LineView> lines = new List <LineView>(); List <ActivityView> activities = new List <ActivityView>(); foreach (Line mLine in m_Lines) { lines.Add(LineView.From(mLine)); } foreach (Activity act in m_Acts) { activities.Add(ActivityView.From(act)); } return(new { lines = lines, activities = activities }); }
void InitView() { var scrollView = new ScrollView() { //Padding = new Thickness(10, 20) }; //Dictionary<string, int> hours = new Dictionary<string, int>(); //for (int i = 0; i <= 23; i++) //{ // hours.Add(i + "小时", i); //} Dictionary<string, int> minutes = new Dictionary<string, int>(); for (int i = 0; i <= 59; i++) { minutes.Add(i + "分钟", i); } Dictionary<string, int> seconds = new Dictionary<string, int>(); for (int i = 0; i <= 60; i++) { seconds.Add(i + "秒钟", i); } Dictionary<string, int> readySeconds = new Dictionary<string, int>(); for (int i = 1; i <= 5; i++) { readySeconds.Add(i + "秒钟", i); } //Picker hourPicker = new Picker() //{ // Title = "小时", // HorizontalOptions = LayoutOptions.FillAndExpand //}; //foreach (var hour in hours) //{ // hourPicker.Items.Add(hour.Key); //} //hourPicker.SelectedIndexChanged += delegate //{ // if (hourPicker.SelectedIndex == -1) // { // Hours = 0; // } // else // { // Hours = hours.ToArray()[hourPicker.SelectedIndex].Value; // } //}; Picker minutePicker = new Picker() { Title = "分钟", HorizontalOptions = LayoutOptions.FillAndExpand }; foreach (var minute in minutes) { minutePicker.Items.Add(minute.Key); } minutePicker.SelectedIndexChanged += delegate { if (minutePicker.SelectedIndex == -1) { Minutes = 0; } else { Minutes = minutes.ToArray()[minutePicker.SelectedIndex].Value; } }; Picker secondPicker = new Picker() { Title = "秒钟", HorizontalOptions = LayoutOptions.FillAndExpand }; foreach (var second in seconds) { secondPicker.Items.Add(second.Key); } secondPicker.SelectedIndexChanged += delegate { if (secondPicker.SelectedIndex == -1) { Seconds = 0; } else { Seconds = seconds.ToArray()[secondPicker.SelectedIndex].Value; } }; Picker readySecondPicker = new Picker() { Title = "秒钟", IsEnabled = false }; foreach (var second in readySeconds) { readySecondPicker.Items.Add(second.Key); } readySecondPicker.SelectedIndex = readySeconds.ToList().FindIndex(w => w.Value == ViewModel.VoiceInterval); readySecondPicker.SelectedIndexChanged += delegate { if (readySecondPicker.SelectedIndex == -1) { VoiceInterval = readySeconds.ToArray()[0].Value; ; } else { VoiceInterval = readySeconds.ToArray()[readySecondPicker.SelectedIndex].Value; } //ViewModel.VoiceInterval = VoiceInterval; }; PanelView panelView1 = new PanelView() { Text = "阶段时间点", TextColor = Color.FromHex("999"), UnderLineColor = Color.FromHex("999"), Content = new StackLayout() { Orientation = StackOrientation.Horizontal, Children = { //hourPicker, minutePicker, secondPicker } } }; PanelView panelView2 = new PanelView() { Text = "播报间隔时间", TextColor = Color.FromHex("999"), UnderLineColor = Color.FromHex("999"), Content = readySecondPicker }; Button saveButton = new Button() { HeightRequest = 40, Text = "确定", BackgroundColor = Consts.ThemeColor, TextColor = Color.White, }; saveButton.Clicked += saveButton_Clicked; LineView line0 = new LineView() { HeightRequest = 10, HorizontalOptions = LayoutOptions.FillAndExpand, //BackgroundColor = Color.FromHex("#f7f7f7") }; LineView line1 = new LineView() { HeightRequest = 8, HorizontalOptions = LayoutOptions.FillAndExpand, //BackgroundColor = Color.FromHex("#f7f7f7") }; LineView line2 = new LineView() { HeightRequest = 8, HorizontalOptions = LayoutOptions.FillAndExpand, //BackgroundColor = Color.FromHex("#f7f7f7") }; //LineView line3 = new LineView() //{ // HeightRequest = 10, // HorizontalOptions = LayoutOptions.FillAndExpand, // BackgroundColor = Color.FromHex("#f7f7f7") //}; scrollView.Content = new StackLayout() { Orientation = StackOrientation.Vertical, Children = {line0, panelView1, line1, panelView2, line2, new StackLayout() { Padding = 10, Children = {saveButton} } } }; Content = scrollView; }
public override void Run(ElmSharp.Box parent) { var scrollView = new ScrollView(parent) { WeightX = 1, WeightY = 1, AlignmentY = -1, AlignmentX = -1, VerticalScrollBarVisibility = ScrollBarVisibility.Always, }; scrollView.Show(); var content = new ElmSharp.Box(parent) { WeightX = 1, WeightY = 1, AlignmentY = -1, AlignmentX = -1, }; scrollView.SetScrollCanvas(content); parent.PackEnd(scrollView); var lineText1 = new ElmSharp.Label(parent) { WeightX = 1, WeightY = 1, Text = "LineView with SolidBrush" }; lineText1.Show(); var line1 = new LineView(parent) { WeightX = 1, WeightY = 1, AlignmentY = -1, AlignmentX = -1, Stroke = new SolidColorBrush(Color.Maroon), StrokeThickness = 5, Aspect = Stretch.Uniform, X1 = 100, Y1 = 0, X2 = 500, Y2 = 300 }; line1.Show(); content.PackEnd(lineText1); content.PackEnd(line1); var lineText2 = new ElmSharp.Label(parent) { WeightX = 1, WeightY = 1, Text = "LineView with GradientBrush" }; lineText2.Show(); var line2 = new LineView(parent) { WeightX = 1, WeightY = 1, AlignmentY = -1, AlignmentX = -1, Stroke = new LinearGradientBrush(new System.Collections.Generic.List <GradientStop>() { new GradientStop(Color.Lavender, 0.2f), new GradientStop(Color.LightSkyBlue, 0.4f), new GradientStop(Color.LightCyan, 0.6f), new GradientStop(Color.LightPink, 0.8f), new GradientStop(Color.YellowGreen, 1.0f), }), StrokeThickness = 15, Aspect = Stretch.Uniform, X1 = 100, Y1 = 300, X2 = 500, Y2 = 100 }; line2.Show(); content.PackEnd(lineText2); content.PackEnd(line2); var lineText3 = new ElmSharp.Label(parent) { WeightX = 1, WeightY = 1, Text = "LineView StrokeDashArray" }; lineText3.Show(); var line3 = new LineView(parent) { WeightX = 1, WeightY = 1, AlignmentY = -1, AlignmentX = -1, Stroke = new SolidColorBrush(Color.PaleGoldenrod), StrokeThickness = 5, Aspect = Stretch.Uniform, X1 = 100, Y1 = 300, X2 = 500, Y2 = 100, StrokeDashArray = new float[] { 9, 3, 5, 3 }, StrokeDashOffset = 5 }; line3.Show(); content.PackEnd(lineText3); content.PackEnd(line3); var lineText4 = new ElmSharp.Label(parent) { WeightX = 1, WeightY = 1, Text = "LineView PenLineCap Test" }; lineText4.Show(); var line4 = new LineView(parent) { WeightX = 1, WeightY = 1, AlignmentY = -1, AlignmentX = -1, Stroke = new SolidColorBrush(Color.Red), StrokeThickness = 15, Aspect = Stretch.Uniform, X1 = 100, Y1 = 300, X2 = 500, Y2 = 100 }; line4.Show(); content.PackEnd(lineText4); content.PackEnd(line4); var lineCapButton = new Button(parent) { Text = "Change PenLineCap", WeightX = 0.5, WeightY = 0.3, AlignmentY = -1, AlignmentX = -1, }; lineCapButton.Show(); lineCapButton.Clicked += (s, e) => { switch (line4.StrokeLineCap) { case (PenLineCap.Flat): line4.StrokeLineCap = PenLineCap.Round; break; case (PenLineCap.Round): line4.StrokeLineCap = PenLineCap.Square; break; case (PenLineCap.Square): line4.StrokeLineCap = PenLineCap.Flat; break; } }; content.PackEnd(lineCapButton); }
public override void Setup() { Win.Title = this.GetName(); Win.Y = 1; // menu Win.Height = Dim.Fill(1); // status bar Top.LayoutSubviews(); var menu = new MenuBar(new MenuBarItem [] { new MenuBarItem("_File", new MenuItem [] { new MenuItem("_Quit", "", () => Quit()), }) }); Top.Add(menu); Win.Add(new Label("Regular Line") { Y = 0 }); // creates a horizontal line var line = new LineView() { Y = 1, }; Win.Add(line); Win.Add(new Label("Double Width Line") { Y = 2 }); // creates a horizontal line var doubleLine = new LineView() { Y = 3, LineRune = '\u2550' }; Win.Add(doubleLine); Win.Add(new Label("Short Line") { Y = 4 }); // creates a horizontal line var shortLine = new LineView() { Y = 5, Width = 10 }; Win.Add(shortLine); Win.Add(new Label("Arrow Line") { Y = 6 }); // creates a horizontal line var arrowLine = new LineView() { Y = 7, Width = 10, StartingAnchor = Application.Driver.LeftTee, EndingAnchor = '>' }; Win.Add(arrowLine); Win.Add(new Label("Vertical Line") { Y = 9, X = 11 }); // creates a horizontal line var verticalLine = new LineView(Terminal.Gui.Graphs.Orientation.Vertical) { X = 25, }; Win.Add(verticalLine); Win.Add(new Label("Vertical Arrow") { Y = 11, X = 28 }); // creates a horizontal line var verticalArrow = new LineView(Terminal.Gui.Graphs.Orientation.Vertical) { X = 27, StartingAnchor = Application.Driver.TopTee, EndingAnchor = 'V' }; Win.Add(verticalArrow); var statusBar = new StatusBar(new StatusItem [] { new StatusItem(Key.CtrlMask | Key.Q, "~^Q~ Quit", () => Quit()) }); Top.Add(statusBar); }
public MiPerfil() { InitializeComponent(); NavigationPage.SetHasNavigationBar(this, false); BackgroundImage = "fondo.png"; LineView linea = new LineView { LineColor = Color.White, LineWidth = 2, //LineCap = LineCap.Butt, LineDirection = LineDirection.RightToLeft }; LineView linea2 = new LineView { LineColor = Color.White, LineWidth = 2, //LineCap = LineCap.Round, LineDirection = LineDirection.RightToLeft }; LineView linea3 = new LineView { LineColor = Color.White, LineWidth = 2, //LineCap = LineCap.Square, LineDirection = LineDirection.LeftToRight, }; RelativeLayout header = new RelativeLayout(); header.Children.Add(linea2, xConstraint: Constraint.RelativeToParent((parent) => { return((parent.Width / 1.8)); }), yConstraint: Constraint.Constant(0), widthConstraint: Constraint.Constant(40), heightConstraint: Constraint.Constant(90)); header.Children.Add(linea, xConstraint: Constraint.Constant(0), yConstraint: Constraint.Constant(120), widthConstraint: Constraint.RelativeToParent((parent) => { return((parent.Width / 2)); }), heightConstraint: Constraint.Constant(100)); header.Children.Add(linea3, xConstraint: Constraint.RelativeToParent((parent) => { return(parent.Width / 2); }), yConstraint: Constraint.Constant(100), widthConstraint: Constraint.RelativeToParent((parent) => { return((parent.Width / 2)); }), heightConstraint: Constraint.Constant(80)); Label nombre = new Label { Text = Settings.session_nombre, WidthRequest = 200, FontSize = 18, HorizontalTextAlignment = TextAlignment.Center, HorizontalOptions = LayoutOptions.CenterAndExpand, FontFamily = Device.OnPlatform("Montserrat-Regular", "Montserrat-Regular", null), TextColor = Color.FromHex("CDCDCD"), }; header.Children.Add(nombre, xConstraint: Constraint.RelativeToParent((parent) => { return(parent.Width / 2 - 100); }), yConstraint: Constraint.Constant(190), widthConstraint: Constraint.Constant(200)); Grid headerContenido = new Grid { Children = { header, new Image { Source = "avatar.png", WidthRequest = 125, HeightRequest = 125, HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Center } } }; Button entrada = new Button { Text = "MI ENTRADA", TextColor = Color.FromHex("3E1152"), FontFamily = Device.OnPlatform("Montserrat-Bold", "Montserrat-Bold", null), FontSize = 15, HorizontalOptions = LayoutOptions.Center, BackgroundColor = Color.FromHex("ffffff"), WidthRequest = 200, HeightRequest = 40, BorderRadius = 20 }; entrada.Clicked += Entrada_Clicked; Button info = new Button { Text = "INFO DEL EVENTO", TextColor = Color.FromHex("3E1152"), FontFamily = Device.OnPlatform("Montserrat-Bold", "Montserrat-Bold", null), FontSize = 15, HorizontalOptions = LayoutOptions.Center, BackgroundColor = Color.FromHex("ffffff"), WidthRequest = 200, HeightRequest = 40, BorderRadius = 20 }; info.Clicked += Info_Clicked; Button cerrarSesion = new Button { Text = "Cerrar sesión", TextColor = Color.White, FontFamily = Device.OnPlatform("Montserrat-Regular", "Montserrat-Regular", null), FontSize = 14, HorizontalOptions = LayoutOptions.Center, BackgroundColor = Color.Transparent, WidthRequest = 125, HeightRequest = 30, BorderRadius = 12, BorderColor = Color.White, BorderWidth = 2 }; cerrarSesion.Clicked += CerrarSesion_Clicked; Content = new ScrollView { Content = new StackLayout { Spacing = 45, Children = { headerContenido, entrada, info, new StackLayout { VerticalOptions = LayoutOptions.EndAndExpand, Padding = new Thickness(0, 0, 0, 40), Children = { cerrarSesion } } } } }; }
public void UpdateLineView(LineView record) { DataContext.Table <Lines>().UpdateRecord(CreateLines(record)); DataContext.Table <LineImpedance>().UpdateRecord(CreateLineImpedance(record)); }
public void AddNewLineView(LineView record) { DataContext.Table <Lines>().AddNewRecord(CreateLines(record)); DataContext.Table <LineImpedance>().AddNewRecord(CreateLineImpedance(record)); }
void InitView() { var scrollView = new ScrollView() { //Padding = new Thickness(10, 20) }; entry = new Entry() { Placeholder = "请输入名称" }; entry.SetBinding(Entry.TextProperty, "Name"); PanelView panelView1 = new PanelView() { Text = "名称", TextColor = Color.FromHex("999"), UnderLineColor = Color.FromHex("999"), Content = entry }; Dictionary<string, int> hours = new Dictionary<string, int>(); for (int i = 0; i <= 2; i++) { hours.Add(i + "小时", i); } Dictionary<string, int> minutes = new Dictionary<string, int>(); for (int i = 0; i <= 59; i++) { minutes.Add(i + "分钟", i); } Dictionary<string, int> seconds = new Dictionary<string, int>(); for (int i = 0; i <= 60; i++) { seconds.Add(i + "秒钟", i); } Dictionary<string, int> readySeconds = new Dictionary<string, int>(); readySeconds.Add("无",0); for (int i = 3; i <= 10; i++) { readySeconds.Add(i + "秒钟", i); } Picker hourPicker = new Picker() { Title = "小时", HorizontalOptions = LayoutOptions.FillAndExpand }; foreach (var hour in hours) { hourPicker.Items.Add(hour.Key); } hourPicker.SelectedIndex = hours.ToList().FindIndex(w => w.Value == Hours); hourPicker.SelectedIndexChanged += delegate { if (hourPicker.SelectedIndex == -1) { Hours = 0; } else { Hours = hours.ToArray()[hourPicker.SelectedIndex].Value; } ViewModel.Duration = ComputeDuration(); }; Picker minutePicker = new Picker() { Title = "分钟", HorizontalOptions = LayoutOptions.FillAndExpand }; foreach (var minute in minutes) { minutePicker.Items.Add(minute.Key); } minutePicker.SelectedIndex = minutes.ToList().FindIndex(w => w.Value == Minutes); minutePicker.SelectedIndexChanged += delegate { if (minutePicker.SelectedIndex == -1) { Minutes = 0; } else { Minutes = minutes.ToArray()[minutePicker.SelectedIndex].Value; } ViewModel.Duration = ComputeDuration(); }; Picker secondPicker = new Picker() { Title = "秒钟", HorizontalOptions = LayoutOptions.FillAndExpand }; foreach (var second in seconds) { secondPicker.Items.Add(second.Key); } secondPicker.SelectedIndex = seconds.ToList().FindIndex(w => w.Value == Seconds); secondPicker.SelectedIndexChanged += delegate { if (secondPicker.SelectedIndex == -1) { Seconds = 0; } else { Seconds = seconds.ToArray()[secondPicker.SelectedIndex].Value; } ViewModel.Duration = ComputeDuration(); }; Picker readySecondPicker = new Picker() { Title = "准备时间", }; foreach (var second in readySeconds) { readySecondPicker.Items.Add(second.Key); } readySecondPicker.SelectedIndex = readySeconds.ToList().FindIndex(w => w.Value == ViewModel.SecendsToReady); readySecondPicker.SelectedIndexChanged += delegate { if (readySecondPicker.SelectedIndex == -1) { ReadySeconds = 0; } else { ReadySeconds = readySeconds.ToArray()[readySecondPicker.SelectedIndex].Value; } ViewModel.SecendsToReady = ReadySeconds; }; PanelView panelView2 = new PanelView() { Text = "方案时长", TextColor = Color.FromHex("999"), UnderLineColor = Color.FromHex("999"), Content = new StackLayout() { Orientation = StackOrientation.Horizontal, Children = { hourPicker, minutePicker, secondPicker } } }; PanelView panelView3 = new PanelView() { Text = "准备时间", TextColor = Color.FromHex("999"), UnderLineColor = Color.FromHex("999"), Content = readySecondPicker }; //text to speak engines var textToSpeak = DependencyService.Get<ITextToSpeech>().New().Init(); //textToSpeak.NoEngine += delegate //{ // DependencyService.Get<Acr.XamForms.UserDialogs.IUserDialogService>().Toast("您的设备上没安装TTS引擎",2); //}; PanelView engineView = null; if (textToSpeak.GetEngines().Count == 0) { var btn = new Button() { Text = "无语音引擎 点击看详情", TextColor = Color.White, BackgroundColor = Consts.ThemeColor }; btn.Clicked += delegate { var uds = DependencyService.Get<Acr.XamForms.UserDialogs.IUserDialogService>(); uds.ActionSheet(new ActionSheetConfig() { Title = "安装语音引擎", Options = { new ActionSheetOption("下载安装讯飞语音+", () => { var url = "http://zhushou.360.cn/detail/index/soft_id/676960"; Device.OpenUri(new Uri(url)); }), new ActionSheetOption("下载安装灵犀语音助手", () => { var url = "http://zhushou.360.cn/detail/index/soft_id/194066"; Device.OpenUri(new Uri(url)); }), new ActionSheetOption("下载安装Google文字转语音 非汉语", () => { var url = "http://zhushou.360.cn/detail/index/soft_id/885077"; Device.OpenUri(new Uri(url)); }), } }); }; engineView = new PanelView() { Text = "语音引擎", TextColor = Color.FromHex("999"), UnderLineColor = Color.FromHex("999"), Content = btn }; } else { Dictionary<string, string> engines = new Dictionary<string, string>(); foreach (var engine in textToSpeak.GetEngines()) { engines.Add(engine.Label, engine.Name); } Picker enginePicker = new Picker() { Title = "选择TTS语音引擎", HorizontalOptions = LayoutOptions.FillAndExpand }; foreach (var engine in engines) { enginePicker.Items.Add(engine.Key); } enginePicker.SelectedIndex = engines.ToList().FindIndex(w => w.Value == ViewModel.VoiceEngine); enginePicker.SelectedIndexChanged += delegate { if (enginePicker.SelectedIndex == -1) { ViewModel.VoiceEngine = engines.ToArray()[0].Value; } else { ViewModel.VoiceEngine = engines.ToArray()[enginePicker.SelectedIndex].Value; } }; engineView = new PanelView() { Text = "语音引擎", TextColor = Color.FromHex("999"), UnderLineColor = Color.FromHex("999"), Content = enginePicker }; } textToSpeak.Dispose(); stageListView = new ListView(); var addStageBtn = new Button() { WidthRequest = 140, HeightRequest = 40, HorizontalOptions = LayoutOptions.Center, Text = "普通阶段", BackgroundColor = Consts.ThemeColor, TextColor = Color.White, Image = "ic_add_white_24dp.png" }; addStageBtn.Clicked += addStageBtn_Clicked; var addFinalStageBtn = new Button() { WidthRequest = 140, HeightRequest = 40, HorizontalOptions = LayoutOptions.Center, Text = "冲刺阶段", BackgroundColor = Consts.ThemeColor, TextColor = Color.White, Image = "ic_add_white_24dp.png" }; addFinalStageBtn.IsEnabled = !ViewModel.HasFinalStage; ViewModel.ObservableStages.CollectionChanged += delegate { addFinalStageBtn.IsEnabled = !ViewModel.HasFinalStage; }; addFinalStageBtn.Clicked += addFinalStageBtn_Clicked; stageListView.Header = new StackLayout() { Padding = 10, Orientation = StackOrientation.Horizontal, HorizontalOptions = LayoutOptions.Center, Children = { addStageBtn, addFinalStageBtn } }; stageListView.SetBinding(ListView.ItemsSourceProperty, "ObservableStages"); stageListView.ItemTemplate = new DataTemplate(typeof(StagesViewCell)); stageListView.HeightRequest = ViewModel.ObservableStages.Count * 45 + 70; stageListView.ItemTapped += stageListView_ItemTapped; PanelView panelView5 = new PanelView() { Text = "播报阶段设置", TextColor = Color.FromHex("999"), UnderLineColor = Color.FromHex("999"), Content = stageListView }; Button saveButton = new Button() { HeightRequest = 40, Text = "保存", BackgroundColor = Consts.ThemeColor, TextColor = Color.White, }; saveButton.Clicked += saveButton_Clicked; LineView line0 = new LineView() { HeightRequest = 10, HorizontalOptions = LayoutOptions.FillAndExpand, //BackgroundColor = Color.FromHex("#f7f7f7") }; LineView line1 = new LineView() { HeightRequest = 8, HorizontalOptions = LayoutOptions.FillAndExpand, //BackgroundColor = Color.FromHex("#f7f7f7") }; LineView line2 = new LineView() { HeightRequest = 8, HorizontalOptions = LayoutOptions.FillAndExpand, //BackgroundColor = Color.FromHex("#f7f7f7") }; LineView line3 = new LineView() { HeightRequest = 8, HorizontalOptions = LayoutOptions.FillAndExpand, //BackgroundColor = Color.FromHex("#f7f7f7") }; LineView line4 = new LineView() { HeightRequest = 8, HorizontalOptions = LayoutOptions.FillAndExpand, //BackgroundColor = Color.FromHex("#f7f7f7") }; LineView line5 = new LineView() { HeightRequest = 8, HorizontalOptions = LayoutOptions.FillAndExpand, //BackgroundColor = Color.FromHex("#f7f7f7") }; scrollView.Content = new StackLayout() { Orientation = StackOrientation.Vertical, Children = {line0, panelView1, line1, panelView2, line2, panelView3, line3, engineView, line4, panelView5, //line5, new StackLayout() { Padding = new Thickness(10,20), Children = {saveButton} } } }; Content = scrollView; ViewModel.ObservableStages.CollectionChanged += ObservableStages_CollectionChanged; }