Dex Common
Image Picker
click the Run Image Picker item in the Visual Studio's DevExpress menu.
Use the following methods to get an image from the Image Picker in code:
Method |
Description |
---|---|
DXImageHelper.GetImageSource |
Retrieves the specified image from the library. |
DXImageHelper.GetImageUri |
Returns a Uri that defines the specified image's location. |
BarButtonItem bOpen = new BarButtonItem { Content = "Open", Glyph = DXImageHelper.GetImageSource("Open", ImageSize.Size16x16), LargeGlyph = DXImageHelper.GetImageSource("Open", ImageSize.Size32x32), RibbonStyle = RibbonItemStyles.Large };
Image Gallery
A special predefined list that is populated with images found in the application's solution or from the DevExpress.Images.v20.1.dll assembly. The library contains common images that are referenced by multiple DevExpress controls. Refer to the DevExpress Image Gallery topic for more information.
Fluent Design
Set the ThemedWindow.EnableAcrylic to true to make the ThemedWindow's background translucent. You can use the ThemedWindow.AcrylicOpacity and ThemedWindow.AcrylicColor properties to specify the opacity and color of the ThemeWindow's background.
Use the RevealHighlightOptions static class to add the Reveal Highlight effect. The DevExpress Hamburger Menu supports the Reveal Highlight effect out of the box.
need reference DevExpress.Xpf.Controls.v20.1.dll 目前看不出效果
Typed Styles
The typed style allows you to define element style in a simplified mannner. need reference the DevExpress.Xpf.TypedStyles assembly
Visual Studio and Blend do not support typed styles. We recommend using typed styles when you edit XAML manually.
Typed styles have comparable performance to regular styles.
<ButtonBaseStyle x:Key="baseStyle" Background="Red" /> <ButtonStyle x:Key="styleWithBaseStyle" BasedOn="{StaticResource baseStyle}" ClickMode="Hover"/>
Attached properties are collected in MergedStyles property:
<BorderStyle x:Key="styleWithAttachedProperties"> <KeyboardNavigationStyle IsTabStop="False" /> <FocusManagerStyle IsFocusScope="False" /> <TextBlockStyle FontSize="13" FontWeight="Bold"/> BorderStyle>
Use the "*_Source" properties for the BindingBase and DynamicResourceExtension markup extensions:
<TextBoxStyle x:Key="TextBoxStyle" Text_Source="{Binding FirstName}" Background_Source="{DynamicResource brush}"/>
To define implicit styles, use x:Key name of TargetType: 以下修改所有按钮的样式
<ButtonStyle x:Key="{x:Type Button}" FontSize="20" FontWeight="Bold" Foreground="Blue" Margin="15" VerticalAlignment="Top"/>
typed triggers
<ButtonStyle x:Key="styleWithTriggers" Margin="1,2,3,4"> <ButtonStyle.Triggers> <ButtonTrigger Visibility="Hidden" IsMouseOver="True"> <TextBlockStyle FontSize="13" /> ButtonTrigger> ButtonStyle.Triggers> ButtonStyle>
以下使按钮颜色变化
<ControlTemplate x:Key="ButtonTemplate" TargetType="Button"> <Border x:Name="border" Background="Red" Padding="15"> <ContentPresenter /> Border> <ControlTemplate.Triggers> <ButtonTrigger IsMouseOver="True" SourceName="border"> <ButtonStyle Background="Green" TargetName="border"/> ButtonTrigger> ControlTemplate.Triggers> ControlTemplate>
If you create triggers for multiple source objects, you can define multiple triggers:
<ControlTemplate x:Key="templateWithDifferentSourceNamesTriggers" TargetType="Button"> <StackPanel> <TextBlock x:Name="textBlock1" /> <TextBlock x:Name="textBlock2" /> StackPanel> <ControlTemplate.Triggers> <ButtonTrigger> <ButtonTrigger.Triggers> <MultiTriggerCollection> <TextBlockTrigger IsMouseOver="True" SourceName="textBlock1"/> <TextBlockTrigger IsKeyboardFocusWithin="True" SourceName="textBlock2"/> MultiTriggerCollection> ButtonTrigger.Triggers> <TextBlockStyle FontWeight="Bold"/> ButtonTrigger> ControlTemplate.Triggers> ControlTemplate>
data triggers
<ButtonStyle x:Key="styleWithDataTriggers" Margin="1,2,3,4"> <ButtonStyle.Triggers> <TypedDataTrigger Binding="{Binding FirstName}" Value="Jon"> <TextBlockStyle FontSize="13" /> TypedDataTrigger> ButtonStyle.Triggers> ButtonStyle>
EnumItemsSource
<dxe:ComboBoxEditSettings ItemsSource="{dxe:EnumItemsSource EnumType=local:UserRole}" IsTextEditable="False" ApplyItemTemplateToSelectedItem="True"/>