public override IViewBuilder CreateView(LoadingStatus viewModel) { var bar = new Virtual.ProgressBar { IsIndeterminate = viewModel.Mode == LoadingStatus.LoadingMode.Indeterminate, Minimum = 0, Maximum = 100, Value = viewModel.PercentCompleted, }; var container = new Virtual.ContentControl { Width = 100, // TODO: this might need to be configurable if LoadingStatus is to be reused outside of the status bar Margin = new Avalonia.Thickness(4), Content = bar, }; var message = new Virtual.TextBlock { Text = viewModel.Message, VerticalAlignment = Avalonia.Layout.VerticalAlignment.Center, }; return(new Virtual.StackPanel { Orientation = Avalonia.Layout.Orientation.Horizontal, Children = new IViewBuilder[] { container, message, } }); }
private IViewBuilder CreateStatusBar(EditorViewModel viewModel) { var items = new List <IViewBuilder>(); var statusText = new Virtual.TextBlock { Text = "Status", VerticalAlignment = Avalonia.Layout.VerticalAlignment.Center, Width = 50, }; statusText.Property(Avalonia.Layout.Layoutable.MarginProperty, new Avalonia.Thickness(8, 0)); items.Add(statusText); if (viewModel.LoadingStatus != null) { var progressBar = new LoadingStatusView(Services).CreateView(viewModel.LoadingStatus); items.Add(progressBar); } return(new Virtual.StackPanel { MinHeight = 20, Children = items, Orientation = Avalonia.Layout.Orientation.Horizontal, }); }
public override IViewBuilder CreateView(MemberViewModel viewModel) { var label = new Virtual.TextBlock { Text = viewModel.Name, HorizontalAlignment = HorizontalAlignment.Left, VerticalAlignment = VerticalAlignment.Center, }; var valueProperty = CreatePropertyView(viewModel); valueProperty.Property(Layoutable.HorizontalAlignmentProperty, HorizontalAlignment.Stretch); valueProperty.Property(Avalonia.Controls.Grid.ColumnProperty, 1); return(new Virtual.Grid { ColumnDefinitions = new Avalonia.Controls.ColumnDefinitions("*,*"), RowDefinitions = new Avalonia.Controls.RowDefinitions("*"), Children = new IViewBuilder[] { label, valueProperty, } }); }