Back to Devexpress

BarEditItem.EditValue Property

wpf-devexpress-dot-xpf-dot-bars-dot-baredititem-6bb0ad95.md

latest7.8 KB
Original Source

BarEditItem.EditValue Property

Specifies the value for the BarEditItem‘s editor. This is a dependency property.

Namespace : DevExpress.Xpf.Bars

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

NuGet Package : DevExpress.Wpf.Core

Declaration

csharp
public object EditValue { get; set; }
vb
Public Property EditValue As Object

Property Value

TypeDescription
Object

An object that represents the edit value for the in-place editor.

|

Remarks

Use the EditValue property to get and set an in-place editor’s value. When setting the EditValue property, ensure that the new value is of the type that is accepted by the in-place editor. For instance, a SpinEdit editor accepts numeric values, while a TextEdit control is used to edit string values.

To respond to changing the EditValue property, handle the BarEditItem.EditValueChanged event.

If a text editor (TextEditSettings) or its descendant is assigned to the BarEditItem, the text being entered in the edit box is saved to the EditValue property with each keystroke by default. To change the trigger for the value validation and posting operation, use the TextEditSettings.ValidateOnTextInput and TextEditSettings.ValidateOnEnterKeyPressed properties. For instance, to validate the text and save it to the EditValue only when the ENTER key is pressed, set the TextEditSettings.ValidateOnTextInput property to false , and the TextEditSettings.ValidateOnEnterKeyPressed property to true.

Example

This example embeds in-place editors into a bar using BarEditItem objects. Two editors ( DateEdit and SpinEdit ) are added with the BarEditItem.EditSettings property. Values for these editors are added through the BarEditItem.EditValue property.

The following image demonstrates the result:

xaml
<Window x:Class="CreateBarEditItems.Window1" 
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
        Title="Window1" Height="300" Width="400" 
        xmlns:dxb="http://schemas.devexpress.com/winfx/2008/xaml/bars" 
        xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors">

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>

        <dxb:BarContainerControl ContainerType="Top" Grid.Row="0">
            <dxb:ToolBarControl Caption="Settings Bar" RotateWhenVertical="True">
                <!--Create a DateEdit and SpinEdit in-place editors -->
                <dxb:BarEditItem x:Name="editItemDateEdit1" Content="Date" EditValue="01/01/2020" EditWidth="100">
                    <dxb:BarEditItem.EditSettings>
                        <dxe:DateEditSettings />
                    </dxb:BarEditItem.EditSettings>
                </dxb:BarEditItem>
                <dxb:BarEditItem x:Name="editItemSpinEdit1" Content="Value" EditValue="123" EditWidth="100">
                    <dxb:BarEditItem.EditSettings>
                        <dxe:SpinEditSettings />
                    </dxb:BarEditItem.EditSettings>
                </dxb:BarEditItem>
            </dxb:ToolBarControl>
        </dxb:BarContainerControl>

        <DockPanel Grid.Row="1" LastChildFill="True">
            <dxb:BarContainerControl ContainerType="Left" DockPanel.Dock="Left"/>
            <dxb:BarContainerControl ContainerType="Right" DockPanel.Dock="Right"/>
            <RichTextBox/>
        </DockPanel>

        <dxb:BarContainerControl ContainerType="Bottom" Grid.Row="2">
            <dxb:StatusBarControl Caption="Status Bar"/>
        </dxb:BarContainerControl>
    </Grid>
</Window>

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

Note

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.

wpf-mvvm-behaviors-barItems-based-theme-selectors/CS/WpfApplication1/MainWindow.xaml#L22

xml
Content="Ribbon Style:"
EditValue="{Binding RibbonStyle, ElementName=RibbonControl}"
EditWidth="100">

wpf-create-a-ribboncontrol/CS/RibbonControl_Ex/MainWindow.xaml#L89

xml
ClosePopupOnChangingEditValue="True"
EditValue="{Binding RibbonStyle, ElementName=RibbonControl}">
<dxb:BarEditItem.EditSettings>

mvvm-application-with-wpf-bars/CS/Bars_in_MVVM_Application/MainWindow.xaml#L62

xml
<dxb:BarItemSeparator/>
<dxb:BarEditItem x:Name="tags" Content="Tags: " EditValue="{Binding SelectedIssue.Tags}" IsVisible="{DXBinding 'SelectedIssue != null'}">
    <dxb:BarEditItem.EditSettings>

wpf-diagram-change-connection-points/CS/MainWindow.xaml.cs#L20

csharp
var editItem = sender as BarEditItem;
var value = Convert.ToInt32(editItem.EditValue);
Point[] points = new Point[value];

wpf-diagram-change-connection-points/VB/MainWindow.xaml.vb#L22

vb
Dim editItem = TryCast(sender, BarEditItem)
Dim value = Convert.ToInt32(editItem.EditValue)
Dim points As Point() = New Point(value - 1) {}

See Also

EditSettings

EditValueChanged

ValidateOnTextInput

ValidateOnEnterKeyPressed

BarEditItem Class

BarEditItem Members

DevExpress.Xpf.Bars Namespace