# .NET MAUI RefreshView Refresh State

The RefreshView refresh state defines whether a refresh is in progress and whether the user can start a refresh with a pull gesture. Use these settings to start a refresh from code, for example, when the page loads, or to block the pull gesture while the data source is unavailable.

## Control the Refresh State

To control the refresh state of the RefreshView, use the following properties:

* `IsRefreshing` (`bool`)—Defines whether a refresh is in progress. Set the property to `true` to start a refresh from code. Set it to `false` to end the refresh and hide the indicator.
* `IsRefreshEnabled` (`bool`)—Defines whether pull gestures can start a refresh. When the value is `false`, the pull gesture is unavailable, but you can still start a refresh by setting `IsRefreshing` to `true`.

The RefreshView doesn't end a refresh on its own. When your data is loaded, set `IsRefreshing` to `false`. When the refresh ends, the RefreshView raises the `Refreshed` event.

## Start and Stop a Refresh Programmatically

The following example demonstrates how to start and stop a refresh with buttons and how to turn the pull gesture on or off with a checkbox.

1. Define the RefreshView in XAML:

   ```XAML
   <telerik:RadRefreshView x:Name="refreshView"
                           IsRefreshEnabled="True"
                           Refreshed="OnRefreshed">
       <VerticalStackLayout Padding="20"
                            Spacing="10"
                            BackgroundColor="#EEEEEE">
           <HorizontalStackLayout Spacing="10">
               <telerik:RadCheckBox IsChecked="{Binding Source={x:Reference refreshView}, Path=IsRefreshEnabled}" />
               <Label Text="IsRefreshEnabled"
                      VerticalOptions="Center" />
           </HorizontalStackLayout>
           <HorizontalStackLayout Spacing="10">
               <telerik:RadTemplatedButton Content="Start Refresh"
                                           Background="LightGray"
                                           Clicked="OnStartRefreshClicked" />
               <telerik:RadTemplatedButton Content="Stop Refresh"
                                           Background="LightGray"
                                           Clicked="OnStopRefreshClicked" />
           </HorizontalStackLayout>
           <Label Text="{Binding Source={x:Reference refreshView}, Path=IsRefreshing, StringFormat='IsRefreshing: {0}'}" />
           <Label Text="Pull down or use the buttons to toggle IsRefreshing. Uncheck IsRefreshEnabled to disable the pull gesture." />
           <Label x:Name="statusLabel"
                  Text="Not refreshed yet" />
       </VerticalStackLayout>
   </telerik:RadRefreshView>
   ```

2. Add the `telerik` namespace:

   ```XAML
   xmlns:telerik="http://schemas.telerik.com/2022/xaml/maui"
   ```

3. Set the `IsRefreshing` property in the button click handlers and handle the `Refreshed` event:

   ```C#
   private void OnStartRefreshClicked(object sender, EventArgs e)
   {
       this.refreshView.IsRefreshing = true;
   }

   private void OnStopRefreshClicked(object sender, EventArgs e)
   {
       this.refreshView.IsRefreshing = false;
   }
   ```

The following image shows the result:

![.NET MAUI RefreshView with an IsRefreshEnabled checkbox, Start Refresh and Stop Refresh buttons, and a label that shows the current IsRefreshing value](https://www.telerik.com/maui-ui/documentation/assets/778384b20b1d78cc1fb7052ea5ba578a/refreshview-refresh-state.gif)

> tip For a runnable example with the RefreshView Refresh State scenario, see the [SDKBrowser Demo Application](https://www.telerik.com/maui-ui/documentation/demos-and-sample-apps/sdkbrowser-app) and go to the **RefreshView > Configuration** category.

## See Also

* [Getting Started with the .NET MAUI RefreshView](https://www.telerik.com/maui-ui/documentation/controls/refreshview/getting-started)
* [RefreshView Events](https://www.telerik.com/maui-ui/documentation/controls/refreshview/events)
* [RefreshView Commands](https://www.telerik.com/maui-ui/documentation/controls/refreshview/commands)
