wpf-devexpress-dot-xpf-dot-core-8b1a880d.md
Serves as a base for classes that represent button controls.
Namespace : DevExpress.Xpf.Core
Assembly : DevExpress.Xpf.Core.v25.2.dll
NuGet Package : DevExpress.Wpf.Core
[DXLicenseWpfEditors]
public class SimpleButton :
Button
<DXLicenseWpfEditors>
Public Class SimpleButton
Inherits Button
The SimpleButton control is a standard System.Windows.Controls.Button descendant and supports all the inherited features.
Use the Content property to specify the SimpleButton ‘s content.
<dx:SimpleButton x:Name="simpleButton" Height="100" Width="226">
<dx:SimpleButton.Content>
<Grid>
<Ellipse Height="80" Width="150" Fill="#FFAFAFF3"/>
<TextBlock TextAlignment="Center" VerticalAlignment="Center" FontSize="30">Button</TextBlock>
</Grid>
</dx:SimpleButton.Content>
</dx:SimpleButton>
Use the SimpleButton.Glyph property to assign a custom glyph.
Assign a glyph from the DXImage extension
Assign a glyph from the image file
Set the SimpleButton.ButtonKind property to Toggle to enable toggle mode.
Toggle mode supports two states, True and False. To enable the Indeterminate state, set the SimpleButton.IsThreeState property to true.
In toggle mode , the following events occur on mouse click:
In repeat mode , the Click event is repeatedly fired until a button is released.
Set the SimpleButton.ButtonKind property to Repeat to enable repeat mode.
Use the SimpleButton.Delay and SimpleButton.Interval properties to control the repeat behavior.
The SimpleButton control can indicate whether an asynchronous operation is in progress. To enable this behavior, set the SimpleButton.AsyncDisplayMode property to Wait or WaitCancel:
<dx:SimpleButton Content="Async Button"
AsyncDisplayMode="WaitCancel"
Command="{Binding AsyncCommand}"/>
using DevExpress.Mvvm;
using System.Threading.Tasks;
// ...
public class ViewModel : ViewModelBase {
public IAsyncCommand AsyncCommand { get; }
public ViewModel() {
AsyncCommand = new AsyncCommand(AsyncMethod);
}
async Task AsyncMethod() {
while(!AsyncCommand.IsCancellationRequested) {
await Task.Delay(100);
}
}
}
Imports DevExpress.Mvvm
Imports System.Threading.Tasks
' ...
Public Class ViewModel
Inherits ViewModelBase
Public ReadOnly Property AsyncCommand As IAsyncCommand
Public Sub New()
AsyncCommand = New AsyncCommand(AddressOf AsyncMethod)
End Sub
Private Async Function AsyncMethod() As Task
While Not AsyncCommand.IsCancellationRequested
Await Task.Delay(100)
End While
End Function
End Class
Refer to the following help topic for more information: Asynchronous Commands.
<Window ...
xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core">
<dx:SimpleButton Background="#FFE9EBEC" BorderThickness="2" BorderBrush="#FF0D3A50"
CornerRadius="5" Height="30" Width="150" Content="Upload" FontSize="10"
Foreground="#ff505050" Glyph="{dx:DXImage SvgImages/Arrows/MoveUp.svg}"
GlyphHeight="20" GlyphWidth="20"/>
</Window>
Tip
Refer to the following topic for more information: Appearance Customization.
The following code snippets (auto-collected from DevExpress Examples) contain references to the SimpleButton class.
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-imageedit-edit-images-in-separate-window/CS/ImageEditToEditModeBehavior/EditImageWindow.xaml#L25
<StackPanel Orientation="Horizontal" Margin="0,4">
<dx:SimpleButton Command="{DXBinding '@e(editBehavior).UndoCommand'}"
Glyph="{dx:DXImage 'SvgImages/Icon Builder/Actions_Undo.svg'}"
wpf-create-a-fluent-design-using-appearance-options/CS/FluentDesignTemplate/MainWindow.xaml#L100
</dxa:AccordionControl>
<dx:SimpleButton Grid.Row="1" CornerRadius="3" Foreground="White" Background="#BF60B5CC" Width="140" Height="40" Content="AI Assistant"/>
<TextBlock Grid.Row="2" HorizontalAlignment="Center" Foreground="#6DFFFFFF" FontFamily="Arial Rounded MT" Text="App v1.01" FontSize="8" Margin="20"/>
wpf-map-search-with-azure-map-search-service/CS/DXMapExample/MainWindow.xaml#L44
</dxlc:LayoutItem>
<dx:SimpleButton Content="Search"
HorizontalAlignment="Right"
wpf-reporting-use-custom-controls-for-editing-report-content-in-print-preview/CS/MainWindow.xaml#L33
<Grid>
<dx:SimpleButton Content="Show Preview" Height="66" HorizontalAlignment="Left" Margin="174,106,0,0" Name="simpleButton1" VerticalAlignment="Top" Width="153" Command="{Binding ShowPreviewCommand}" />
<!--<dx:SimpleButton Content="Show Designer" Height="66" HorizontalAlignment="Left" Margin="172,0,0,81" Name="simpleButton2" VerticalAlignment="Bottom" Width="153" Command="{Binding ShowDesignerCommand}" />-->
wpf-richedit-use-document-iterator-and-visitor/CS/DocumentIteratorExample/MainWindow.xaml#L12
<StackPanel Width="280">
<dx:SimpleButton Height="25"
Margin="5,20,5,0"
Show 15 items
Object DispatcherObject DependencyObject Visual UIElement FrameworkElement Control ContentControl ButtonBase Button SimpleButton DropDownButtonBase
See Also