Skip to main content

BarStaticItem Class

Represents a bar item that allows you to display static text.

Namespace: DevExpress.Xpf.Bars

Assembly: DevExpress.Xpf.Core.v22.2.dll

NuGet Package: DevExpress.Wpf.Core


public class BarStaticItem :


Use a BarStaticItem object to display static text in bars and menus.


You can customize the auto-size mode for BarStaticItem items via the BarStaticItem.AutoSizeMode property. Setting this property to Fill stretches the item’s links, so that they occupy the largest possible area of a bar.


This example shows how to create BarStaticItem items, used to display static text within bars.

The following image shows the result:


View Example

Imports System
Imports System.Collections.Generic
Imports System.Linq
Imports System.Text
Imports System.Windows
Imports System.Windows.Controls
Imports System.Windows.Data
Imports System.Windows.Documents
Imports System.Windows.Input
Imports System.Windows.Media
Imports System.Windows.Media.Imaging
Imports System.Windows.Navigation
Imports System.Windows.Shapes

Namespace BarStaticItemEx
    ''' <summary>
    ''' Interaction logic for Window1.xaml
    ''' </summary>
    Partial Public Class Window1
        Inherits Window

        Public Sub New()
            AddHandler rtfEditor.SelectionChanged, AddressOf rtfEditor_SelectionChanged
        End Sub

        Private Sub rtfEditor_SelectionChanged(ByVal sender As Object, ByVal e As RoutedEventArgs)
            Dim line As Integer = 0
            Dim col As Integer = 0
            rtfEditor.CaretPosition.GetLineStartPosition(-100000, line)
            col = rtfEditor.CaretPosition.GetOffsetToPosition(rtfEditor.CaretPosition.GetLineStartPosition(0))
            staticItemLine.Content = "Line: " & (-line).ToString() & "  Position: " & (-col).ToString()
        End Sub
    End Class
End Namespace

The following code snippets (auto-collected from DevExpress Examples) contain references to the BarStaticItem class.


The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.


See Also