Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

Center Content

You can add any content to the center of the gauge.

To do so, specify a gauge’s Content property. The ContentTemplate property allows you to define content appearance. ContentTemplate uses the object you put to Content as its binding context.

DevExpress Gauges for .NET MAUI - Custom center content

<dx:RadialGauge ...
                  Content="{Binding GaugeCenterContent}">
    <dx:RadialGauge.BindingContext>
        <local:MainViewModel/>
    </dx:RadialGauge.BindingContext>
    <dx:RadialGauge.ContentTemplate>
        <DataTemplate>
            <HorizontalStackLayout>
                <dx:DXImage Source="{Binding Icon}" 
                            WidthRequest="28" HeightRequest="28" 
                            TintColor="#48B5EE"/>
                <Label Text="{Binding Text}" VerticalOptions="Center" 
                       Margin="5,0" FontAttributes="Bold"/>
            </HorizontalStackLayout>
        </DataTemplate>
    </dx:RadialGauge.ContentTemplate>
    <dx:RadialScale ...
                    StartValue="0" EndValue="1" 
                    TickmarkLabelFormat="p0">
        <dx:MarkerIndicator .../>
    </dx:RadialScale>
</dx:RadialGauge>
public class MainViewModel {
    public GaugeCenterContent GaugeCenterContent { get; set; } = new () { Text = "Air humidity", Icon = ImageSource.FromFile ("drop.svg") };
}
public class GaugeCenterContent {
    public ImageSource Icon { get; set; }
    public string Text { get; set; }
}