Is it possible to use the BusyIndicator without the Content Property?

2 posts, 0 answers
  1. Trevor
    Trevor avatar
    18 posts
    Member since:
    Feb 2017

    Posted 22 Sep Link to this post

    I have a bunch of ActivityIndicators in my application already, but the native ActivityIndicator doesn't scale well on iOS. Is it possible to just use the BusyIndicator without content? I don't want to have to refactor my views if I do not have to.
  2. Lance | Tech Support Engineer, Sr.
    Admin
    Lance | Tech Support Engineer, Sr. avatar
    419 posts

    Posted 22 Sep Link to this post

    Hello Trevor,

    To use the control as it was designed to, you should use the content property. However there is a trick you can use to just overlay it.

    Pasted below is a demo I've written that will overlays the RadBusyIndicator on top the the green BoxView by toggling the IsVisible and IsBusy properties:

    XAML:

    <?xml version="1.0" encoding="utf-8" ?>
    <ContentPage x:Name="MyPage" xmlns="http://xamarin.com/schemas/2014/forms"
                 xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
                 xmlns:telerikPrimitives="clr-namespace:Telerik.XamarinForms.Primitives;assembly=Telerik.XamarinForms.Primitives"
                 x:Class="TrevorDemo.Portable.StartPage">
     
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition/>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>
             
            <BoxView WidthRequest="200" HeightRequest="200" BackgroundColor="Green" HorizontalOptions="Center" VerticalOptions="Center"></BoxView>
             
            <telerikPrimitives:RadBusyIndicator x:Name="BusyIndicator" IsVisible="False">
                <telerikPrimitives:RadBusyIndicator.Content>
                    <Grid BindingContext="{x:Reference MyPage}" HeightRequest="{Binding Height}" WidthRequest="{Binding Width}">
                         
                    </Grid>
                </telerikPrimitives:RadBusyIndicator.Content>
            </telerikPrimitives:RadBusyIndicator>
             
            <Button Text="Toggle BusyIndicator" Clicked="Button_OnClicked" Grid.Row="1"/>
        </Grid>
         
    </ContentPage>

    Code behind:

    namespace TrevorDemo.Portable
    {
        public partial class StartPage : ContentPage
        {
            public StartPage()
            {
                InitializeComponent();
            }
     
            private void Button_OnClicked(object sender, EventArgs e)
            {
                BusyIndicator.IsVisible = !BusyIndicator.IsVisible;
                BusyIndicator.IsBusy = !BusyIndicator.IsBusy;
            }
        }
    }



    Wrapping Up

    If this answers your question, you can let me know by selecting the ticket's "Mark as resolved" button. If you have any further difficulty, please share your code so that we can investigate further.

    Thank you for contacting Support and for choosing UI for Xamarin.

    Regards,
    Lance | Tech Support Engineer, Sr.
    Progress Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top