public ShellNavBar(IMauiContext context) : base(context?.GetNativeParent()) { MauiContext = context; _ = NativeParent ?? throw new ArgumentNullException(nameof(NativeParent)); SetLayoutCallback(OnLayout); _menuButton = new TButton(NativeParent); _menuButton.Clicked += OnMenuClicked; _menuIcon = new TImage(NativeParent); UpdateMenuIcon(); _title = new TLabel(NativeParent) { FontSize = this.GetDefaultTitleFontSize(), VerticalTextAlignment = (global::Tizen.UIExtensions.Common.TextAlignment)TextAlignment.Center, TextColor = _titleColor.ToCommon(), FontAttributes = Tizen.UIExtensions.Common.FontAttributes.Bold, }; _title.Show(); BackgroundColor = _backgroudColor; _menuButton.BackgroundColor = _backgroudColor; PackEnd(_menuButton); PackEnd(_title); }
public ShellNavBar(IMauiContext context) : base(context?.GetPlatformParent()) { MauiContext = context; SetLayoutCallback(OnLayout); _menuButton = new TButton(PlatformParent); _menuButton.Clicked += OnMenuClicked; _menuIcon = new MaterialIcon(PlatformParent) { Color = _foregroundColor.ToCommon() }; UpdateMenuIcon(); _title = new TLabel(PlatformParent) { FontSize = this.GetDefaultTitleFontSize(), VerticalTextAlignment = (global::Tizen.UIExtensions.Common.TextAlignment)TextAlignment.Center, TextColor = _titleColor.ToCommon(), FontAttributes = Tizen.UIExtensions.Common.FontAttributes.Bold, }; _title.Show(); BackgroundColor = _backgroudColor; _menuButton.BackgroundColor = _backgroudColor; PackEnd(_menuButton); PackEnd(_title); }
EvasObject CreateFooter(EvasObject parent) { var footer = new Box(parent); footer.BackgroundColor = Color.Blue; footer.MinimumHeight = 200; var footerLabel = new Ext.Label(parent) { FormattedText = new Common.FormattedString { Spans = { new Common.Span { Text = "Footer", FontAttributes = Common.FontAttributes.Bold, HorizontalTextAlignment = Common.TextAlignment.Center, FontSize = 60, } } } }; footerLabel.Show(); footer.PackEnd(footerLabel); return(footer); }
EvasObject CreateHeader(EvasObject parent) { _header = new Box(parent); _header.BackgroundColor = Color.Red; _header.MinimumHeight = 150; var headerLabel = new Ext.Label(parent) { FormattedText = new Common.FormattedString { Spans = { new Common.Span { Text = "Header", FontAttributes = Common.FontAttributes.Bold, HorizontalTextAlignment = Common.TextAlignment.Center, FontSize = 60, } } } }; headerLabel.Show(); _header.PackEnd(headerLabel); return(_header); }
public override void Run(ElmSharp.Box parent) { var label = new Label(parent) { WeightX = 1, WeightY = 1, AlignmentY = 0.5, AlignmentX = 0.5, FontSize = 30, FormattedText = new FormattedString { Spans = { new Span { Text = "Span1-bold ", FontAttributes = FontAttributes.Bold, }, new Span { Text = "Span2-red ", ForegroundColor = Color.Red }, new Span { Text = "Span3-Large", FontSize = 60, } } } }; label.Show(); parent.PackEnd(label); }
public override void Run(ElmSharp.Box parent) { DateTimePicker dateTime = new DateTimePicker(parent) { WeightX = 1, WeightY = 1, AlignmentY = -1, AlignmentX = -1, MinimumDateTime = new DateTime(2021, 1, 1), MaximumDateTime = DateTime.Now, DateTime = DateTime.Now }; Label label1 = new Label(parent) { WeightX = 1, WeightY = 1, AlignmentY = -1, AlignmentX = -1 }; Label label2 = new Label(parent) { WeightX = 1, WeightY = 1, AlignmentY = -1, AlignmentX = -1 }; Label label3 = new Label(parent) { WeightX = 1, WeightY = 1, AlignmentY = -1, AlignmentX = -1, Text = string.Format("Current DateTime={0}", dateTime.DateTime), }; dateTime.DateTimeChanged += (object sender, DateChangedEventArgs e) => { label1.Text = string.Format("Old DateTime={0}", e.OldDate); label2.Text = string.Format("New DateTime={0}", e.NewDate); label3.Text = string.Format("Current DateTime={0}", dateTime.DateTime); }; dateTime.Show(); label1.Show(); label2.Show(); label3.Show(); parent.PackEnd(dateTime); parent.PackEnd(label1); parent.PackEnd(label2); parent.PackEnd(label3); }
public override void Run(ElmSharp.Box parent) { DateTimePicker dateTime = new DateTimePicker(parent) { WeightX = 1, WeightY = 1, AlignmentY = -1, AlignmentX = -1, DateTime = DateTime.Today, Style = "time_layout", Format = "%d/%b/%Y %I:%M %p" }; Label label1 = new Label(parent) { WeightX = 1, WeightY = 1, AlignmentY = -1, AlignmentX = -1 }; Label label2 = new Label(parent) { WeightX = 1, WeightY = 1, AlignmentY = -1, AlignmentX = -1 }; Label label3 = new Label(parent) { WeightX = 1, WeightY = 1, AlignmentY = -1, AlignmentX = -1, Text = string.Format("Current DateTime={0}", dateTime.DateTime), }; dateTime.DateTimeChanged += (object sender, DateChangedEventArgs e) => { label1.Text = string.Format("Old DateTime={0}", e.OldDate); label2.Text = string.Format("New DateTime={0}", e.NewDate); label3.Text = string.Format("Current DateTime={0}", dateTime.DateTime); }; dateTime.Show(); label1.Show(); label2.Show(); label3.Show(); parent.PackEnd(dateTime); parent.PackEnd(label1); parent.PackEnd(label2); parent.PackEnd(label3); }
public override void Run(ElmSharp.Box parent) { Button btn = new Button(parent) { AlignmentX = -1, WeightX = 1, Text = "Open Dialog" }; btn.Show(); Label label1 = new Label(parent) { WeightX = 1, WeightY = 1, AlignmentY = -1, AlignmentX = -1 }; label1.Show(); Label label2 = new Label(parent) { WeightX = 1, WeightY = 1, AlignmentY = -1, AlignmentX = -1 }; label2.Show(); parent.PackEnd(btn); parent.PackEnd(label1); parent.PackEnd(label2); DateTimePickerDialog dialog = new DateTimePickerDialog(parent) { Mode = DateTimePickerMode.Date, MinimumDateTime = new DateTime(2021, 1, 1), MaximumDateTime = DateTime.Now, DateTime = DateTime.Now }; dialog.DateTimeChanged += (s, e) => { label1.Text = e.NewDate.ToString(); }; dialog.PickerClosed += (s, e) => { label2.Text = "PickerClosed"; }; dialog.PickerOpened += (s, e) => { label2.Text = "PickerOpened"; }; btn.Clicked += (s, e) => { dialog.Show(); }; }
public override void Run(ElmSharp.Box parent) { var scrollview = new ScrollView(parent) { WeightX = 1, WeightY = 1, AlignmentY = -1, AlignmentX = -1, }; scrollview.Show(); scrollview.ScrollOrientation = ScrollOrientation.Vertical; parent.PackEnd(scrollview); var scrollCanvas = new ElmSharp.Box(parent) { AlignmentX = -1, AlignmentY = -1, WeightX = 1, WeightY = 1, }; scrollCanvas.Show(); scrollview.SetScrollCanvas(scrollCanvas); RadioButton rd1 = new RadioButton(parent) { StateValue = 1, Text = "Value #1", TextColor = Color.Violet, TextBackgroundColor = Color.Yellow, AlignmentX = -1, AlignmentY = 0, WeightX = 1, WeightY = 1 }; rd1.Show(); Radio rd2 = new Radio(parent) { StateValue = 2, Text = "Value #2", AlignmentX = -1, AlignmentY = 0, WeightX = 1, WeightY = 1 }; rd2.Show(); Radio rd3 = new Radio(parent) { StateValue = 3, Text = "Value #3", AlignmentX = -1, AlignmentY = 0, WeightX = 1, WeightY = 1 }; rd3.Show(); rd2.SetGroup(rd1); rd3.SetGroup(rd2); var label = new Label(parent) { AlignmentX = -1, AlignmentY = 0, WeightX = 1, WeightY = 1 }; label.Show(); rd1.ValueChanged += OnRadioValueChanged; rd2.ValueChanged += OnRadioValueChanged; rd3.ValueChanged += OnRadioValueChanged; void OnRadioValueChanged(object sender, EventArgs e) { label.Text = string.Format("Value Changed: {0}", ((Radio)sender).GroupValue); } scrollCanvas.PackEnd(label); scrollCanvas.PackEnd(rd1); scrollCanvas.PackEnd(rd2); scrollCanvas.PackEnd(rd3); scrollview.SetContentSize(720, 3000); }
public override void Run(ElmSharp.Box parent) { var scrollview = new ScrollView(parent) { WeightX = 1, WeightY = 1, AlignmentY = -1, AlignmentX = -1, }; scrollview.Show(); scrollview.ScrollOrientation = ScrollOrientation.Vertical; parent.PackEnd(scrollview); var scrollCanvas = new ElmSharp.Box(parent) { AlignmentX = -1, AlignmentY = -1, WeightX = 1, WeightY = 1, }; scrollCanvas.Show(); scrollview.SetScrollCanvas(scrollCanvas); var img1 = new Image(parent) { AlignmentX = -1, AlignmentY = -1, WeightX = 1, WeightY = 1, MinimumHeight = 300, }; img1.Show(); img1.LoadAsync(Application.Current.DirectoryInfo.Resource + "image.png"); scrollCanvas.PackEnd(img1); { var label = new Label(parent) { Text = "AspectFill" }; label.Show(); scrollCanvas.PackEnd(label); var img2 = new Image(parent) { AlignmentX = -1, AlignmentY = -1, WeightX = 1, WeightY = 1, MinimumHeight = 300, }; img2.Show(); img2.Aspect = Aspect.AspectFill; img2.LoadAsync("http://i.imgur.com/9f974SC.jpg"); img2.LoadingCompleted += (s, e) => Console.WriteLine($"Loading completed"); scrollCanvas.PackEnd(img2); } { var label = new Label(parent) { Text = "AppectFit" }; label.Show(); scrollCanvas.PackEnd(label); var img2 = new Image(parent) { AlignmentX = -1, AlignmentY = -1, WeightX = 1, WeightY = 1, MinimumHeight = 300, }; img2.Show(); img2.Aspect = Aspect.AspectFit; img2.LoadAsync("http://i.imgur.com/9f974SC.jpg"); img2.LoadingCompleted += (s, e) => Console.WriteLine($"Loading completed"); scrollCanvas.PackEnd(img2); } { var label = new Label(parent) { Text = "Fill" }; label.Show(); scrollCanvas.PackEnd(label); var img2 = new Image(parent) { AlignmentX = -1, AlignmentY = -1, WeightX = 1, WeightY = 1, MinimumHeight = 300, }; img2.Show(); img2.Aspect = Aspect.Fill; img2.LoadAsync("http://i.imgur.com/9f974SC.jpg"); img2.LoadingCompleted += (s, e) => Console.WriteLine($"Loading completed"); scrollCanvas.PackEnd(img2); } { var label = new Label(parent) { Text = "Animated" }; label.Show(); scrollCanvas.PackEnd(label); var animated = new Image(parent) { AlignmentX = -1, AlignmentY = -1, WeightX = 1, WeightY = 1, MinimumHeight = 300, }; animated.Show(); animated.Aspect = Aspect.AspectFit; animated.LoadAsync(Application.Current.DirectoryInfo.Resource + "animated.gif"); animated.LoadingCompleted += (s, e) => { Console.WriteLine($"Loading completed"); animated.SetIsAnimationPlaying(true); }; scrollCanvas.PackEnd(animated); } { var label = new Label(parent) { Text = "IsAnimationPlaying = false" }; label.Show(); scrollCanvas.PackEnd(label); var img2 = new Image(parent) { AlignmentX = -1, AlignmentY = -1, WeightX = 1, WeightY = 1, MinimumHeight = 300, }; img2.Show(); img2.Aspect = Aspect.AspectFit; img2.LoadAsync(Application.Current.DirectoryInfo.Resource + "animated2.gif"); img2.LoadingCompleted += (s, e) => { Console.WriteLine($"Loading completed"); (s as Image).SetIsAnimationPlaying(false); }; scrollCanvas.PackEnd(img2); } scrollview.SetContentSize(720, 3000); }