A newer version of this page is available. Switch to the current version.

BarStaticItem Class

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

Namespace: DevExpress.Xpf.Bars

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


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


See Also