public BaseAsyncActivityTemplate() { // Adds the Content Presenter var contentPresenter = new ContentPresenter(); Children.Add(contentPresenter, 0, 0); // The overlay that is presented when an Activity is Running var overlayGrid = new Grid { BackgroundColor = Color.FromHex("#CCCCCCCC") }; overlayGrid.SetBinding(IsVisibleProperty, new TemplateBinding("IsActivityRunning")); var descriptionLabel = new Label { TextColor = Color.White }; descriptionLabel.SetBinding(Label.TextProperty, new TemplateBinding("ActivityDescription")); var activityIndicator = new ActivityIndicator { Color = Color.White }; activityIndicator.SetBinding(ActivityIndicator.IsRunningProperty, new TemplateBinding("IsActivityRunning")); // A layout to hold the Activity Indicator and Description var activityIndicatorLayout = new StackLayout { HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Center, }; activityIndicatorLayout.Children.Add(activityIndicator); activityIndicatorLayout.Children.Add(descriptionLabel); // Finally add the indicator to the overlay and the overlay to the grid overlayGrid.Children.Add(activityIndicatorLayout, 0, 0); Children.Add(overlayGrid); }
public AquaTemplate() { RowDefinitions.Add (new RowDefinition { Height = new GridLength (0.1, GridUnitType.Star) }); RowDefinitions.Add (new RowDefinition { Height = new GridLength (0.8, GridUnitType.Star) }); RowDefinitions.Add (new RowDefinition { Height = new GridLength (0.1, GridUnitType.Star) }); ColumnDefinitions.Add (new ColumnDefinition { Width = new GridLength (0.05, GridUnitType.Star) }); ColumnDefinitions.Add (new ColumnDefinition { Width = new GridLength (0.95, GridUnitType.Star) }); var topBoxView = new BoxView { Color = Color.Aqua }; Children.Add (topBoxView, 0, 0); Grid.SetColumnSpan (topBoxView, 2); var topLabel = new Label { Text = "Control Template Demo App", TextColor = Color.Blue, VerticalOptions = LayoutOptions.Center }; Children.Add (topLabel, 1, 0); var contentPresenter = new ContentPresenter (); Children.Add (contentPresenter, 0, 1); Grid.SetColumnSpan (contentPresenter, 2); var bottomBoxView = new BoxView { Color = Color.Aqua }; Children.Add (bottomBoxView, 0, 2); Grid.SetColumnSpan (bottomBoxView, 2); var bottomLabel = new Label { Text = "(c) Xamarin 2016", TextColor = Color.Blue, VerticalOptions = LayoutOptions.Center }; Children.Add (bottomLabel, 1, 2); }
public TealTemplate () { RowDefinitions.Add (new RowDefinition { Height = new GridLength (0.1, GridUnitType.Star) }); RowDefinitions.Add (new RowDefinition { Height = new GridLength (0.8, GridUnitType.Star) }); RowDefinitions.Add (new RowDefinition { Height = new GridLength (0.1, GridUnitType.Star) }); ColumnDefinitions.Add (new ColumnDefinition { Width = new GridLength (0.05, GridUnitType.Star) }); ColumnDefinitions.Add (new ColumnDefinition { Width = new GridLength (0.95, GridUnitType.Star) }); var topBoxView = new BoxView { Color = Color.Teal }; Children.Add (topBoxView, 0, 0); Grid.SetColumnSpan (topBoxView, 2); var topLabel = new Label { TextColor = Color.White, VerticalOptions = LayoutOptions.Center }; topLabel.SetBinding (Label.TextProperty, new TemplateBinding ("Parent.HeaderText")); Children.Add (topLabel, 1, 0); var contentPresenter = new ContentPresenter (); Children.Add (contentPresenter, 0, 1); Grid.SetColumnSpan (contentPresenter, 2); var bottomBoxView = new BoxView { Color = Color.Teal }; Children.Add (bottomBoxView, 0, 2); Grid.SetColumnSpan (bottomBoxView, 2); var bottomLabel = new Label { TextColor = Color.White, VerticalOptions = LayoutOptions.Center }; bottomLabel.SetBinding (Label.TextProperty, new TemplateBinding ("Parent.FooterText")); Children.Add (bottomLabel, 1, 2); }
public PresenterWrapper () { Content = new ContentPresenter (); }