add RichTextBox style
This commit is contained in:
1 parent
7035c25349
commit
9b839a1532
12 files changed
+115
-1
No files matched your search
@@ -467,6 +467,10 @@
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Themes\Styles\RichTextBox.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Themes\Styles\ScrollViewer.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:controls="clr-namespace:HandyControl.Controls">
|
||||
|
||||
<Style x:Key="TextBoxBaseBaseStyle" TargetType="{x:Type TextBoxBase}">
|
||||
<Setter Property="Background" Value="{DynamicResource RegionBrush}"/>
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
|
||||
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}"/>
|
||||
<Setter Property="BorderThickness" Value="1"/>
|
||||
<Setter Property="CaretBrush" Value="{DynamicResource PrimaryTextBrush}"/>
|
||||
<Setter Property="controls:BorderElement.CornerRadius" Value="4"/>
|
||||
<Setter Property="KeyboardNavigation.TabNavigation" Value="None"/>
|
||||
<Setter Property="HorizontalContentAlignment" Value="Left"/>
|
||||
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
|
||||
<Setter Property="AllowDrop" Value="true"/>
|
||||
<Setter Property="Padding" Value="2,7"/>
|
||||
<Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst"/>
|
||||
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Hidden"/>
|
||||
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Hidden"/>
|
||||
<Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type TextBoxBase}">
|
||||
<Border x:Name="border" CornerRadius="{Binding Path=(controls:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
|
||||
<ScrollViewer x:Name="PART_ContentHost" Padding="{TemplateBinding Padding}" Focusable="false" HorizontalScrollBarVisibility="{Binding Path=(ScrollViewer.HorizontalScrollBarVisibility),RelativeSource={RelativeSource TemplatedParent}}" VerticalScrollBarVisibility="{Binding Path=(ScrollViewer.VerticalScrollBarVisibility),RelativeSource={RelativeSource TemplatedParent}}"/>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsEnabled" Value="false">
|
||||
<Setter Property="Opacity" TargetName="border" Value="0.4"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsMouseOver" Value="true">
|
||||
<Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource SecondaryBorderBrush}"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsFocused" Value="true">
|
||||
<Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource PrimaryBrush}"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="RichTextBoxBaseStyle" BasedOn="{StaticResource TextBoxBaseBaseStyle}" TargetType="RichTextBox">
|
||||
<Setter Property="MinWidth" Value="10"/>
|
||||
</Style>
|
||||
|
||||
<Style BasedOn="{StaticResource RichTextBoxBaseStyle}" TargetType="RichTextBox"/>
|
||||
|
||||
</ResourceDictionary>
|
||||
@@ -42,6 +42,7 @@
|
||||
<ResourceDictionary Source="DateTimePicker.xaml"/>
|
||||
<ResourceDictionary Source="GroupBox.xaml"/>
|
||||
<ResourceDictionary Source="ListView.xaml"/>
|
||||
<ResourceDictionary Source="RichTextBox.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
|
||||
</ResourceDictionary>
|
||||
@@ -98,6 +98,8 @@
|
||||
|
||||
public static readonly string ListViewDemoCtl = nameof(ListViewDemoCtl);
|
||||
|
||||
public static readonly string RichTextBoxDemoCtl = nameof(RichTextBoxDemoCtl);
|
||||
|
||||
public static readonly string CommonWindow = nameof(CommonWindow);
|
||||
|
||||
public static readonly string CustomNonClientAreaWindow = nameof(CustomNonClientAreaWindow);
|
||||
|
||||
@@ -54,7 +54,8 @@ var styleList = new List<string>
|
||||
"BrushDemoCtl",
|
||||
"SliderDemoCtl",
|
||||
"GroupBoxDemoCtl",
|
||||
"ListViewDemoCtl"
|
||||
"ListViewDemoCtl",
|
||||
"RichTextBoxDemoCtl"
|
||||
};
|
||||
var windowList = new List<string>
|
||||
{
|
||||
|
||||
@@ -237,6 +237,9 @@
|
||||
<Compile Include="UserControl\Styles\RadioButtonDemoCtl.xaml.cs">
|
||||
<DependentUpon>RadioButtonDemoCtl.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="UserControl\Styles\RichTextBoxDemoCtl.xaml.cs">
|
||||
<DependentUpon>RichTextBoxDemoCtl.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="UserControl\Styles\SliderDemoCtl.xaml.cs">
|
||||
<DependentUpon>SliderDemoCtl.xaml</DependentUpon>
|
||||
</Compile>
|
||||
@@ -515,6 +518,10 @@
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="UserControl\Styles\RichTextBoxDemoCtl.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="UserControl\Styles\SliderDemoCtl.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
@@ -571,6 +578,7 @@
|
||||
<Generator>TextTemplatingFileGenerator</Generator>
|
||||
<LastGenOutput>MessageToken.cs</LastGenOutput>
|
||||
</Content>
|
||||
<Resource Include="Resources\Img\LeftMainContent\RichTextBox_16x.png" />
|
||||
<Resource Include="Resources\Img\LeftMainContent\ListView_16x.png" />
|
||||
<Resource Include="Resources\Img\LeftMainContent\GroupBox_16x.png" />
|
||||
<Resource Include="Resources\Img\LeftMainContent\ColorWheel_16x.png" />
|
||||
|
||||
@@ -717,6 +717,15 @@ namespace HandyControlDemo.Properties.Langs {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 富文本框 的本地化字符串。
|
||||
/// </summary>
|
||||
public static string RichTextBox {
|
||||
get {
|
||||
return ResourceManager.GetString("RichTextBox", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 在这里右击 的本地化字符串。
|
||||
/// </summary>
|
||||
|
||||
@@ -391,4 +391,7 @@
|
||||
<data name="ListView" xml:space="preserve">
|
||||
<value>列表视图</value>
|
||||
</data>
|
||||
<data name="RichTextBox" xml:space="preserve">
|
||||
<value>富文本框</value>
|
||||
</data>
|
||||
</root>
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 205 B |
@@ -125,6 +125,11 @@
|
||||
<Image Source="../../Resources/Img/LeftMainContent/ContextMenu_16x.png"/>
|
||||
</controls:EdgeElement.LeftContent>
|
||||
</ListBoxItem>
|
||||
<ListBoxItem Style="{StaticResource ListBoxItemNew}" Tag="{x:Static data:MessageToken.RichTextBoxDemoCtl}" Content="{x:Static langs:Lang.RichTextBox}">
|
||||
<controls:EdgeElement.LeftContent>
|
||||
<Image Source="../../Resources/Img/LeftMainContent/RichTextBox_16x.png"/>
|
||||
</controls:EdgeElement.LeftContent>
|
||||
</ListBoxItem>
|
||||
<ListBoxItem Tag="{x:Static data:MessageToken.BorderDemoCtl}" Content="{x:Static langs:Lang.Border1}">
|
||||
<controls:EdgeElement.LeftContent>
|
||||
<Image Source="../../Resources/Img/LeftMainContent/BorderElement_16x.png"/>
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
<UserControl x:Class="HandyControlDemo.UserControl.RichTextBoxDemoCtl"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:controls="clr-namespace:HandyControl.Controls;assembly=HandyControl"
|
||||
xmlns:langs="clr-namespace:HandyControlDemo.Properties.Langs"
|
||||
Background="{DynamicResource RegionBrush}">
|
||||
<controls:TransitioningContentControl>
|
||||
<RichTextBox Margin="32" Width="400" Height="300" ScrollViewer.VerticalScrollBarVisibility="Auto">
|
||||
<FlowDocument>
|
||||
<Paragraph>
|
||||
<Run FontSize="20" Text="{Binding Source={x:Static langs:Lang.Title},Converter={StaticResource StringRepeatConverter},ConverterParameter=20,Mode=OneWay}"/>
|
||||
</Paragraph>
|
||||
<Paragraph>
|
||||
<Run Text="{Binding Source={x:Static langs:Lang.Text},Converter={StaticResource StringRepeatConverter},ConverterParameter=1000,Mode=OneWay}"/>
|
||||
</Paragraph>
|
||||
<Paragraph>
|
||||
<Hyperlink>https://github.com/NaBian/HandyControl</Hyperlink>
|
||||
</Paragraph>
|
||||
</FlowDocument>
|
||||
</RichTextBox>
|
||||
</controls:TransitioningContentControl>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,10 @@
|
||||
namespace HandyControlDemo.UserControl
|
||||
{
|
||||
public partial class RichTextBoxDemoCtl
|
||||
{
|
||||
public RichTextBoxDemoCtl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user