Merge pull request #211 from HandyOrg/pr/84

Pr/84
This commit is contained in:
NaBian authored and GitHub committed 2019-11-07 23:39:52 +08:00
commit 1ec8d6da33
36 files changed
+700 -69

No files matched your search

+6 -2
View File
@@ -65,6 +65,10 @@ Step 4:enjoy coding
## Latest examples
### Poptip
![Poptip](https://raw.githubusercontent.com/HandyOrg/HandyOrgResource/master/HandyControl/Resources/Poptip.gif)
### Divider
![Divider](https://raw.githubusercontent.com/HandyOrg/HandyOrgResource/master/HandyControl/Resources/Divider.png)
@@ -81,12 +85,12 @@ Step 4:enjoy coding
![FloatingBlock](https://raw.githubusercontent.com/HandyOrg/HandyOrgResource/master/HandyControl/Resources/FloatingBlock.gif)
## History publication
### HoneycombPanel
![HoneycombPanel](https://raw.githubusercontent.com/HandyOrg/HandyOrgResource/master/HandyControl/Resources/HoneycombPanel.png)
## History publication
### RunningBlock
![RunningBlock](https://raw.githubusercontent.com/HandyOrg/HandyOrgResource/master/HandyControl/Resources/RunningBlock.gif)
@@ -436,6 +436,9 @@
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\LeftMainContent\DottedSplitter_16x.png">
<Link>Resources\Img\LeftMainContent\DottedSplitter_16x.png</Link>
</Resource>
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\LeftMainContent\PopupCursor_16x.png">
<Link>Resources\Img\LeftMainContent\PopupCursor_16x.png</Link>
</Resource>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="..\..\Shared\HandyControlDemo_Shared\Properties\Langs\Lang.en.resx">
@@ -430,6 +430,9 @@
<Generator>TextTemplatingFileGenerator</Generator>
<LastGenOutput>MessageToken.cs</LastGenOutput>
</Content>
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\LeftMainContent\PopupCursor_16x.png">
<Link>Resources\Img\LeftMainContent\PopupCursor_16x.png</Link>
</Resource>
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\Cover.png">
<Link>Resources\Img\Cover.png</Link>
</Resource>
@@ -496,6 +496,9 @@
<Generator>TextTemplatingFileGenerator</Generator>
<LastGenOutput>MessageToken.cs</LastGenOutput>
</Content>
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\LeftMainContent\PopupCursor_16x.png">
<Link>Resources\Img\LeftMainContent\PopupCursor_16x.png</Link>
</Resource>
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\Cover.png">
<Link>Resources\Img\Cover.png</Link>
</Resource>
+22 -23
View File
@@ -19,10 +19,10 @@ namespace HandyControlDemo
[SuppressMessage("代码质量", "IDE0052:删除未读的私有成员", Justification = "<挂起>")]
private static Mutex AppMutex;
public App()
protected override void OnStartup(StartupEventArgs e)
{
AppMutex = new Mutex(true, "HandyControlDemo", out var createdNew);
if (!createdNew)
{
var current = Process.GetCurrentProcess();
@@ -37,29 +37,28 @@ namespace HandyControlDemo
}
Shutdown();
}
}
protected override void OnStartup(StartupEventArgs e)
{
var splashScreen = new SplashScreen("Resources/Img/Cover.png");
splashScreen.Show(true);
base.OnStartup(e);
UpdateRegistry();
ShutdownMode = ShutdownMode.OnMainWindowClose;
GlobalData.Init();
ConfigHelper.Instance.SetLang(GlobalData.Config.Lang);
if (GlobalData.Config.Skin != SkinType.Default)
else
{
UpdateSkin(GlobalData.Config.Skin);
var splashScreen = new SplashScreen("Resources/Img/Cover.png");
splashScreen.Show(true);
base.OnStartup(e);
UpdateRegistry();
ShutdownMode = ShutdownMode.OnMainWindowClose;
GlobalData.Init();
ConfigHelper.Instance.SetLang(GlobalData.Config.Lang);
if (GlobalData.Config.Skin != SkinType.Default)
{
UpdateSkin(GlobalData.Config.Skin);
}
ConfigHelper.Instance.SetSystemVersionInfo(CommonHelper.GetSystemVersionInfo());
ServicePointManager.SecurityProtocol = (SecurityProtocolType)(SslProtocols)0x00000C00;
}
ConfigHelper.Instance.SetSystemVersionInfo(CommonHelper.GetSystemVersionInfo());
ServicePointManager.SecurityProtocol = (SecurityProtocolType)(SslProtocols)0x00000C00;
}
protected override void OnExit(ExitEventArgs e)
@@ -12,7 +12,7 @@ namespace HandyControlDemo.Data
try
{
var json = File.ReadAllText(AppConfig.SavePath);
Config = JsonConvert.DeserializeObject<AppConfig>(json);
Config = (string.IsNullOrEmpty(json) ? new AppConfig() : JsonConvert.DeserializeObject<AppConfig>(json)) ?? new AppConfig();
}
catch
{
@@ -98,6 +98,8 @@
public static readonly string GridDemoCtl = nameof(GridDemoCtl);
public static readonly string PoptipDemoCtl = nameof(PoptipDemoCtl);
public static readonly string RangeSliderDemoCtl = nameof(RangeSliderDemoCtl);
public static readonly string ButtonGroupDemoCtl = nameof(ButtonGroupDemoCtl);
@@ -51,6 +51,7 @@ var controlList = new List<string>
"DialogDemoCtl",
"SideMenuDemoCtl",
"GridDemoCtl",
"PoptipDemoCtl",
"RangeSliderDemoCtl",
"ButtonGroupDemoCtl",
"CardDemoCtl",
@@ -161,6 +161,9 @@
<Compile Include="$(MSBuildThisFileDirectory)UserControl\Controls\PasswordBoxDemoCtl.xaml.cs">
<DependentUpon>PasswordBoxDemoCtl.xaml</DependentUpon>
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)UserControl\Controls\PoptipDemoCtl.xaml.cs">
<DependentUpon>PoptipDemoCtl.xaml</DependentUpon>
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)UserControl\Controls\PreviewSliderDemoCtl.xaml.cs">
<DependentUpon>PreviewSliderDemoCtl.xaml</DependentUpon>
</Compile>
@@ -604,6 +607,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="$(MSBuildThisFileDirectory)UserControl\Controls\PoptipDemoCtl.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="$(MSBuildThisFileDirectory)UserControl\Controls\PreviewSliderDemoCtl.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
@@ -1122,6 +1122,24 @@ namespace HandyControlDemo.Properties.Langs {
}
}
/// <summary>
/// 查找类似 气泡提示 的本地化字符串。
/// </summary>
public static string Poptip {
get {
return ResourceManager.GetString("Poptip", resourceCulture);
}
}
/// <summary>
/// 查找类似 上左;上边;上右;右上;右边;右下;下右;下边;下左;左下;左边;左上 的本地化字符串。
/// </summary>
public static string PoptipPositionStr {
get {
return ResourceManager.GetString("PoptipPositionStr", resourceCulture);
}
}
/// <summary>
/// 查找类似 上一步 的本地化字符串。
/// </summary>
@@ -600,6 +600,9 @@
<data name="Border" xml:space="preserve">
<value>Border</value>
</data>
<data name="Poptip" xml:space="preserve">
<value>Poptip</value>
</data>
<data name="Recommendation" xml:space="preserve">
<value>Recommendation</value>
</data>
@@ -678,4 +681,7 @@
<data name="Divider" xml:space="preserve">
<value>Divider</value>
</data>
<data name="PoptipPositionStr" xml:space="preserve">
<value>top-start;top;top-end;right-start;right;right-end;bottom-end;bottom;bottom-start;left-end;left;left-start</value>
</data>
</root>
@@ -678,4 +678,10 @@
<data name="Divider" xml:space="preserve">
<value>Divider</value>
</data>
<data name="Poptip" xml:space="preserve">
<value>Poptip</value>
</data>
<data name="PoptipPositionStr" xml:space="preserve">
<value>top-start;top;top-end;right-start;right;right-end;bottom-end;bottom;bottom-start;left-end;left;left-start</value>
</data>
</root>
@@ -678,4 +678,10 @@
<data name="Divider" xml:space="preserve">
<value>Divider</value>
</data>
<data name="Poptip" xml:space="preserve">
<value>Poptip</value>
</data>
<data name="PoptipPositionStr" xml:space="preserve">
<value>top-start;top;top-end;right-start;right;right-end;bottom-end;bottom;bottom-start;left-end;left;left-start</value>
</data>
</root>
@@ -600,6 +600,9 @@
<data name="ResponsiveLayout" xml:space="preserve">
<value>响应式布局</value>
</data>
<data name="Poptip" xml:space="preserve">
<value>气泡提示</value>
</data>
<data name="Recommendation" xml:space="preserve">
<value>群友推荐</value>
</data>
@@ -678,4 +681,7 @@
<data name="Divider" xml:space="preserve">
<value>分割线</value>
</data>
<data name="PoptipPositionStr" xml:space="preserve">
<value>上左;上边;上右;右上;右边;右下;下右;下边;下左;左下;左边;左上</value>
</data>
</root>
Binary file not shown.

After

Width:  |  Height:  |  Size: 359 B

@@ -23,7 +23,7 @@
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.ItemTemplate>
<DataTemplate DataType="data:CardModel">
<DataTemplate>
<hc:Gravatar Style="{StaticResource GravatarCircle}" Margin="10" Source="{Binding Content}"/>
</DataTemplate>
</ListBox.ItemTemplate>
@@ -0,0 +1,78 @@
<UserControl x:Class="HandyControlDemo.UserControl.PoptipDemoCtl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
Background="{DynamicResource RegionBrush}"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:langs="clr-namespace:HandyControlDemo.Properties.Langs"
xmlns:hc="https://handyorg.github.io/handycontrol"
xmlns:system="clr-namespace:System;assembly=mscorlib">
<UserControl.Resources>
<Style x:Key="Button4PoptipStyle" BasedOn="{StaticResource {x:Type Button}}" TargetType="Button">
<Setter Property="Width" Value="{x:Static system:Double.NaN}"/>
<Setter Property="Height" Value="50"/>
<Setter Property="MinWidth" Value="100"/>
<Setter Property="HorizontalAlignment" Value="Stretch"/>
<Setter Property="Content" Value="{Binding Tag,RelativeSource={RelativeSource Self},Converter={StaticResource Int2StringConverter},ConverterParameter={x:Static langs:Lang.PoptipPositionStr}}"/>
</Style>
<Style x:Key="ToggleButton4PoptipStyle" BasedOn="{StaticResource {x:Type ToggleButton}}" TargetType="ToggleButton">
<Setter Property="Width" Value="{x:Static system:Double.NaN}"/>
<Setter Property="Height" Value="50"/>
<Setter Property="MinWidth" Value="100"/>
<Setter Property="HorizontalAlignment" Value="Stretch"/>
<Setter Property="Content" Value="{Binding Tag,RelativeSource={RelativeSource Self},Converter={StaticResource Int2StringConverter},ConverterParameter={x:Static langs:Lang.PoptipPositionStr}}"/>
</Style>
</UserControl.Resources>
<hc:TransitioningContentControl>
<Grid Margin="24,320">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<UniformGrid Grid.Column="1" Columns="3">
<Button Margin="8,0" Tag="0" Style="{StaticResource Button4PoptipStyle}">
<hc:Poptip.Instance>
<hc:Poptip Content="{x:Static langs:Lang.Text}" Placement="TopLeft"/>
</hc:Poptip.Instance>
</Button>
<Button Margin="8,0" Tag="1" Style="{StaticResource Button4PoptipStyle}">
<hc:Poptip.Instance>
<hc:Poptip Placement="Top">
<hc:Poptip.Content>
<Path Width="100" Height="100" Fill="#f06632" Data="{StaticResource LogoGeometry}"/>
</hc:Poptip.Content>
</hc:Poptip>
</hc:Poptip.Instance>
</Button>
<Button hc:Poptip.Content="{x:Static langs:Lang.Text}" hc:Poptip.Placement="TopRight" Margin="8,0" Tag="2" Style="{StaticResource Button4PoptipStyle}"/>
</UniformGrid>
<UniformGrid Grid.Row="1" Grid.Column="2" Rows="3">
<ToggleButton hc:Poptip.HitMode="None" hc:Poptip.IsOpen="{Binding IsChecked,RelativeSource={RelativeSource Self}}" hc:Poptip.Content="{x:Static langs:Lang.Text}" hc:Poptip.Placement="RightTop" Margin="8,16" Tag="3" Style="{StaticResource ToggleButton4PoptipStyle}"/>
<ToggleButton Margin="8,16" Tag="4" Style="{StaticResource ToggleButton4PoptipStyle}">
<hc:Poptip.Instance>
<hc:Poptip Background="Transparent" Padding="0" BorderThickness="0" HitMode="None" Placement="Right" IsOpen="{Binding Target.IsChecked,RelativeSource={RelativeSource Self}}">
<hc:Poptip.Content>
<Path Width="100" Height="100" Fill="#f06632" Data="{StaticResource LogoGeometry}"/>
</hc:Poptip.Content>
</hc:Poptip>
</hc:Poptip.Instance>
</ToggleButton>
<ToggleButton hc:Poptip.HitMode="None" hc:Poptip.IsOpen="{Binding IsChecked,RelativeSource={RelativeSource Self}}" hc:Poptip.Content="{x:Static langs:Lang.Text}" hc:Poptip.Placement="RightBottom" Margin="8,16" Tag="5" Style="{StaticResource ToggleButton4PoptipStyle}"/>
</UniformGrid>
<UniformGrid Grid.Column="1" Grid.Row="2" Columns="3">
<Button hc:Poptip.Content="{x:Static langs:Lang.Text}" hc:Poptip.Placement="BottomLeft" Margin="8,0" Tag="8" Style="{StaticResource Button4PoptipStyle}"/>
<Button hc:Poptip.Content="{x:Static langs:Lang.Text}" hc:Poptip.Placement="Bottom" Margin="8,0" Tag="7" Style="{StaticResource Button4PoptipStyle}"/>
<Button hc:Poptip.Content="{x:Static langs:Lang.Text}" hc:Poptip.Placement="BottomRight" Margin="8,0" Tag="6" Style="{StaticResource Button4PoptipStyle}"/>
</UniformGrid>
<UniformGrid Grid.Row="1" Grid.Column="0" Rows="3">
<Button hc:Poptip.Content="{x:Static langs:Lang.Text}" hc:Poptip.Placement="LeftTop" hc:Poptip.HitMode="Focus" Margin="8,16" Tag="11" Style="{StaticResource Button4PoptipStyle}"/>
<Button hc:Poptip.Content="{x:Static langs:Lang.Text}" hc:Poptip.Placement="Left" hc:Poptip.HitMode="Focus" Margin="8,16" Tag="10" Style="{StaticResource Button4PoptipStyle}"/>
<Button hc:Poptip.Content="{x:Static langs:Lang.Text}" hc:Poptip.Placement="LeftBottom" hc:Poptip.HitMode="Focus" Margin="8,16" Tag="9" Style="{StaticResource Button4PoptipStyle}"/>
</UniformGrid>
</Grid>
</hc:TransitioningContentControl>
</UserControl>
@@ -0,0 +1,10 @@
namespace HandyControlDemo.UserControl
{
public partial class PoptipDemoCtl
{
public PoptipDemoCtl()
{
InitializeComponent();
}
}
}
@@ -7,20 +7,20 @@
<hc:TransitioningContentControl>
<WrapPanel Margin="16" VerticalAlignment="Center">
<StackPanel Margin="16" Button.Click="ButtonProgress_OnClick">
<hc:ProgressButton IsChecked="{Binding IsUploading,Mode=TwoWay}" Progress="{Binding Progress}" Content="{Binding IsChecked,RelativeSource={RelativeSource Self},Converter={StaticResource Boolean2StrConverter},ConverterParameter={x:Static langs:Lang.UploadStr}}" Width="180" Margin="5"/>
<hc:ProgressButton Style="{StaticResource ProgressButtonPrimary}" IsChecked="{Binding IsUploading,Mode=TwoWay}" Progress="{Binding Progress}" Content="{Binding IsChecked,RelativeSource={RelativeSource Self},Converter={StaticResource Boolean2StrConverter},ConverterParameter={x:Static langs:Lang.UploadStr}}" Width="180" Margin="5"/>
<hc:ProgressButton Style="{StaticResource ProgressButtonSuccess}" IsChecked="{Binding IsUploading,Mode=TwoWay}" Progress="{Binding Progress}" Content="{Binding IsChecked,RelativeSource={RelativeSource Self},Converter={StaticResource Boolean2StrConverter},ConverterParameter={x:Static langs:Lang.UploadStr}}" Width="180" Margin="5"/>
<hc:ProgressButton Style="{StaticResource ProgressButtonInfo}" IsChecked="{Binding IsUploading,Mode=TwoWay}" Progress="{Binding Progress}" Content="{Binding IsChecked,RelativeSource={RelativeSource Self},Converter={StaticResource Boolean2StrConverter},ConverterParameter={x:Static langs:Lang.UploadStr}}" Width="180" Margin="5"/>
<hc:ProgressButton Style="{StaticResource ProgressButtonWarning}" IsChecked="{Binding IsUploading,Mode=TwoWay}" Progress="{Binding Progress}" Content="{Binding IsChecked,RelativeSource={RelativeSource Self},Converter={StaticResource Boolean2StrConverter},ConverterParameter={x:Static langs:Lang.UploadStr}}" Width="180" Margin="5"/>
<hc:ProgressButton Style="{StaticResource ProgressButtonDanger}" IsChecked="{Binding IsUploading,Mode=TwoWay}" Progress="{Binding Progress}" Content="{Binding IsChecked,RelativeSource={RelativeSource Self},Converter={StaticResource Boolean2StrConverter},ConverterParameter={x:Static langs:Lang.UploadStr}}" Width="180" Margin="5"/>
<hc:ProgressButton IsChecked="{Binding IsUploading,Mode=TwoWay}" Progress="{Binding Progress}" Content="{Binding IsChecked,RelativeSource={RelativeSource Self},Converter={StaticResource Boolean2StringConverter},ConverterParameter={x:Static langs:Lang.UploadStr}}" Width="180" Margin="5"/>
<hc:ProgressButton Style="{StaticResource ProgressButtonPrimary}" IsChecked="{Binding IsUploading,Mode=TwoWay}" Progress="{Binding Progress}" Content="{Binding IsChecked,RelativeSource={RelativeSource Self},Converter={StaticResource Boolean2StringConverter},ConverterParameter={x:Static langs:Lang.UploadStr}}" Width="180" Margin="5"/>
<hc:ProgressButton Style="{StaticResource ProgressButtonSuccess}" IsChecked="{Binding IsUploading,Mode=TwoWay}" Progress="{Binding Progress}" Content="{Binding IsChecked,RelativeSource={RelativeSource Self},Converter={StaticResource Boolean2StringConverter},ConverterParameter={x:Static langs:Lang.UploadStr}}" Width="180" Margin="5"/>
<hc:ProgressButton Style="{StaticResource ProgressButtonInfo}" IsChecked="{Binding IsUploading,Mode=TwoWay}" Progress="{Binding Progress}" Content="{Binding IsChecked,RelativeSource={RelativeSource Self},Converter={StaticResource Boolean2StringConverter},ConverterParameter={x:Static langs:Lang.UploadStr}}" Width="180" Margin="5"/>
<hc:ProgressButton Style="{StaticResource ProgressButtonWarning}" IsChecked="{Binding IsUploading,Mode=TwoWay}" Progress="{Binding Progress}" Content="{Binding IsChecked,RelativeSource={RelativeSource Self},Converter={StaticResource Boolean2StringConverter},ConverterParameter={x:Static langs:Lang.UploadStr}}" Width="180" Margin="5"/>
<hc:ProgressButton Style="{StaticResource ProgressButtonDanger}" IsChecked="{Binding IsUploading,Mode=TwoWay}" Progress="{Binding Progress}" Content="{Binding IsChecked,RelativeSource={RelativeSource Self},Converter={StaticResource Boolean2StringConverter},ConverterParameter={x:Static langs:Lang.UploadStr}}" Width="180" Margin="5"/>
</StackPanel>
<StackPanel Margin="16" Button.Click="ButtonProgress_OnClick">
<ToggleButton Style="{StaticResource ToggleButtonLoading}" IsChecked="{Binding IsUploading,Mode=TwoWay}" Content="{Binding IsChecked,RelativeSource={RelativeSource Self},Converter={StaticResource Boolean2StrConverter},ConverterParameter={x:Static langs:Lang.UploadStr}}" Width="180" Margin="5"/>
<ToggleButton Style="{StaticResource ToggleButtonLoadingPrimary}" IsChecked="{Binding IsUploading,Mode=TwoWay}" Content="{Binding IsChecked,RelativeSource={RelativeSource Self},Converter={StaticResource Boolean2StrConverter},ConverterParameter={x:Static langs:Lang.UploadStr}}" Width="180" Margin="5"/>
<ToggleButton Style="{StaticResource ToggleButtonLoadingSuccess}" IsChecked="{Binding IsUploading,Mode=TwoWay}" Content="{Binding IsChecked,RelativeSource={RelativeSource Self},Converter={StaticResource Boolean2StrConverter},ConverterParameter={x:Static langs:Lang.UploadStr}}" Width="180" Margin="5"/>
<ToggleButton Style="{StaticResource ToggleButtonLoadingInfo}" IsChecked="{Binding IsUploading,Mode=TwoWay}" Content="{Binding IsChecked,RelativeSource={RelativeSource Self},Converter={StaticResource Boolean2StrConverter},ConverterParameter={x:Static langs:Lang.UploadStr}}" Width="180" Margin="5"/>
<ToggleButton Style="{StaticResource ToggleButtonLoadingWarning}" IsChecked="{Binding IsUploading,Mode=TwoWay}" Content="{Binding IsChecked,RelativeSource={RelativeSource Self},Converter={StaticResource Boolean2StrConverter},ConverterParameter={x:Static langs:Lang.UploadStr}}" Width="180" Margin="5"/>
<ToggleButton Style="{StaticResource ToggleButtonLoadingDanger}" IsChecked="{Binding IsUploading,Mode=TwoWay}" Content="{Binding IsChecked,RelativeSource={RelativeSource Self},Converter={StaticResource Boolean2StrConverter},ConverterParameter={x:Static langs:Lang.UploadStr}}" Width="180" Margin="5"/>
<ToggleButton Style="{StaticResource ToggleButtonLoading}" IsChecked="{Binding IsUploading,Mode=TwoWay}" Content="{Binding IsChecked,RelativeSource={RelativeSource Self},Converter={StaticResource Boolean2StringConverter},ConverterParameter={x:Static langs:Lang.UploadStr}}" Width="180" Margin="5"/>
<ToggleButton Style="{StaticResource ToggleButtonLoadingPrimary}" IsChecked="{Binding IsUploading,Mode=TwoWay}" Content="{Binding IsChecked,RelativeSource={RelativeSource Self},Converter={StaticResource Boolean2StringConverter},ConverterParameter={x:Static langs:Lang.UploadStr}}" Width="180" Margin="5"/>
<ToggleButton Style="{StaticResource ToggleButtonLoadingSuccess}" IsChecked="{Binding IsUploading,Mode=TwoWay}" Content="{Binding IsChecked,RelativeSource={RelativeSource Self},Converter={StaticResource Boolean2StringConverter},ConverterParameter={x:Static langs:Lang.UploadStr}}" Width="180" Margin="5"/>
<ToggleButton Style="{StaticResource ToggleButtonLoadingInfo}" IsChecked="{Binding IsUploading,Mode=TwoWay}" Content="{Binding IsChecked,RelativeSource={RelativeSource Self},Converter={StaticResource Boolean2StringConverter},ConverterParameter={x:Static langs:Lang.UploadStr}}" Width="180" Margin="5"/>
<ToggleButton Style="{StaticResource ToggleButtonLoadingWarning}" IsChecked="{Binding IsUploading,Mode=TwoWay}" Content="{Binding IsChecked,RelativeSource={RelativeSource Self},Converter={StaticResource Boolean2StringConverter},ConverterParameter={x:Static langs:Lang.UploadStr}}" Width="180" Margin="5"/>
<ToggleButton Style="{StaticResource ToggleButtonLoadingDanger}" IsChecked="{Binding IsUploading,Mode=TwoWay}" Content="{Binding IsChecked,RelativeSource={RelativeSource Self},Converter={StaticResource Boolean2StringConverter},ConverterParameter={x:Static langs:Lang.UploadStr}}" Width="180" Margin="5"/>
</StackPanel>
</WrapPanel>
</hc:TransitioningContentControl>
@@ -245,6 +245,11 @@
<Image Source="../../Resources/Img/LeftMainContent/Bubble_16xLG.png"/>
</hc:EdgeElement.LeftContent>
</ListBoxItem>
<ListBoxItem Style="{StaticResource ListBoxItemNew}" Tag="{x:Static data:MessageToken.PoptipDemoCtl}" Content="{x:Static langs:Lang.Poptip}">
<hc:EdgeElement.LeftContent>
<Image Source="../../Resources/Img/LeftMainContent/PopupCursor_16x.png"/>
</hc:EdgeElement.LeftContent>
</ListBoxItem>
<ListBoxItem Tag="{x:Static data:MessageToken.NotifyIconDemoCtl}" Content="{x:Static langs:Lang.NotifyIcon}">
<hc:EdgeElement.LeftContent>
<Image Source="../../Resources/Img/LeftMainContent/NotificationHub_16x.png"/>
@@ -465,7 +470,7 @@
<Image Source="../../Resources/Img/LeftMainContent/HandyControl.png"/>
</hc:EdgeElement.LeftContent>
</ListBoxItem>
<ListBoxItem Style="{StaticResource ListBoxItemNew}" Tag="{x:Static data:MessageToken.NotificationDemoCtl}" Content="{x:Static langs:Lang.Notification}">
<ListBoxItem Tag="{x:Static data:MessageToken.NotificationDemoCtl}" Content="{x:Static langs:Lang.Notification}">
<hc:EdgeElement.LeftContent>
<Image Source="../../Resources/Img/LeftMainContent/Procedure_16x.png"/>
</hc:EdgeElement.LeftContent>
@@ -10,11 +10,11 @@ namespace HandyControl.Controls
public class SplitButton : ButtonBase
{
public static readonly DependencyProperty HitModeProperty = DependencyProperty.Register(
"HitMode", typeof(MouseHitMode), typeof(SplitButton), new PropertyMetadata(default(MouseHitMode)));
"HitMode", typeof(HitMode), typeof(SplitButton), new PropertyMetadata(default(HitMode)));
public MouseHitMode HitMode
public HitMode HitMode
{
get => (MouseHitMode) GetValue(HitModeProperty);
get => (HitMode) GetValue(HitModeProperty);
set => SetValue(HitModeProperty, value);
}
@@ -62,7 +62,7 @@ namespace HandyControl.Controls
{
base.OnPreviewMouseLeftButtonDown(e);
if (HitMode == MouseHitMode.Hover)
if (HitMode == HitMode.Hover)
{
e.Handled = true;
}
@@ -72,7 +72,7 @@ namespace HandyControl.Controls
{
base.OnMouseEnter(e);
if (HitMode == MouseHitMode.Hover)
if (HitMode == HitMode.Hover)
{
SetCurrentValue(IsDropDownOpenProperty, ValueBoxes.TrueBox);
}
@@ -59,7 +59,7 @@ namespace HandyControl.Controls
}
}
return new Size(constraint.Width, _maxChildDesiredHeight * totalRowCount - Gutter);
return new Size(0, _maxChildDesiredHeight * totalRowCount - Gutter);
}
protected override Size ArrangeOverride(Size finalSize)
@@ -0,0 +1,361 @@
using System;
using System.ComponentModel;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Data;
using System.Windows.Input;
using HandyControl.Data;
using HandyControl.Data.Enum;
namespace HandyControl.Controls
{
public class Poptip : Control
{
private readonly Popup _popup;
private UIElement _elementTarget;
public Poptip()
{
_popup = new Popup
{
AllowsTransparency = true,
Child = this
};
_popup.SetBinding(DataContextProperty, new Binding(DataContextProperty.Name) {Source = this});
}
public static readonly DependencyProperty HitModeProperty = DependencyProperty.RegisterAttached(
"HitMode", typeof(HitMode), typeof(Poptip), new PropertyMetadata(HitMode.Hover));
public static void SetHitMode(DependencyObject element, HitMode value)
=> element.SetValue(HitModeProperty, value);
public static HitMode GetHitMode(DependencyObject element)
=> (HitMode) element.GetValue(HitModeProperty);
public HitMode HitMode
{
get => (HitMode)GetValue(HitModeProperty);
set => SetValue(HitModeProperty, value);
}
private static readonly DependencyProperty IsInstanceProperty = DependencyProperty.RegisterAttached(
"IsInstance", typeof(bool), typeof(Poptip), new PropertyMetadata(ValueBoxes.TrueBox));
private static void SetIsInstance(DependencyObject element, bool value)
=> element.SetValue(IsInstanceProperty, value);
private static bool GetIsInstance(DependencyObject element)
=> (bool) element.GetValue(IsInstanceProperty);
public static readonly DependencyProperty ContentProperty = DependencyProperty.RegisterAttached(
"Content", typeof(object), typeof(Poptip), new PropertyMetadata(default, OnContentChanged));
private static void OnContentChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
if (d is Poptip) return;
if (GetInstance(d) == null)
{
SetInstance(d, Default);
SetIsInstance(d, false);
}
}
public static void SetContent(DependencyObject element, object value)
=> element.SetValue(ContentProperty, value);
public static object GetContent(DependencyObject element)
=> element.GetValue(ContentProperty);
public object Content
{
get => GetValue(ContentProperty);
set => SetValue(ContentProperty, value);
}
public static readonly DependencyProperty ContentTemplateProperty = DependencyProperty.Register(
"ContentTemplate", typeof(DataTemplate), typeof(Poptip), new PropertyMetadata(default(DataTemplate)));
public DataTemplate ContentTemplate
{
get => (DataTemplate)GetValue(ContentTemplateProperty);
set => SetValue(ContentTemplateProperty, value);
}
public static readonly DependencyProperty ContentStringFormatProperty = DependencyProperty.Register(
"ContentStringFormat", typeof(string), typeof(Poptip), new PropertyMetadata(default(string)));
public string ContentStringFormat
{
get => (string)GetValue(ContentStringFormatProperty);
set => SetValue(ContentStringFormatProperty, value);
}
public static readonly DependencyProperty ContentTemplateSelectorProperty = DependencyProperty.Register(
"ContentTemplateSelector", typeof(DataTemplateSelector), typeof(Poptip), new PropertyMetadata(default(DataTemplateSelector)));
public DataTemplateSelector ContentTemplateSelector
{
get => (DataTemplateSelector)GetValue(ContentTemplateSelectorProperty);
set => SetValue(ContentTemplateSelectorProperty, value);
}
public static readonly DependencyProperty OffsetProperty = DependencyProperty.RegisterAttached(
"Offset", typeof(double), typeof(Poptip), new PropertyMetadata(6.0));
public static void SetOffset(DependencyObject element, double value)
=> element.SetValue(OffsetProperty, value);
public static double GetOffset(DependencyObject element)
=> (double) element.GetValue(OffsetProperty);
public double Offset
{
get => (double)GetValue(OffsetProperty);
set => SetValue(OffsetProperty, value);
}
public static readonly DependencyProperty PlacementProperty = DependencyProperty.RegisterAttached(
"Placement", typeof(TipPlacement), typeof(Poptip), new PropertyMetadata(TipPlacement.Top));
public static void SetPlacement(DependencyObject element, TipPlacement value)
=> element.SetValue(PlacementProperty, value);
public static TipPlacement GetPlacement(DependencyObject element)
=> (TipPlacement) element.GetValue(PlacementProperty);
public TipPlacement Placement
{
get => (TipPlacement)GetValue(PlacementProperty);
set => SetValue(PlacementProperty, value);
}
public static readonly DependencyProperty IsOpenProperty = DependencyProperty.RegisterAttached(
"IsOpen", typeof(bool), typeof(Poptip), new PropertyMetadata(ValueBoxes.FalseBox, OnIsOpenChanged));
private static void OnIsOpenChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
if (d is Poptip poptip)
{
poptip.SwitchPoptip((bool) e.NewValue);
}
else
{
GetInstance(d)?.SwitchPoptip((bool)e.NewValue);
}
}
public static void SetIsOpen(DependencyObject element, bool value)
=> element.SetValue(IsOpenProperty, value);
public static bool GetIsOpen(DependencyObject element)
=> (bool) element.GetValue(IsOpenProperty);
public bool IsOpen
{
get => (bool) GetValue(IsOpenProperty);
set => SetValue(IsOpenProperty, value);
}
public static readonly DependencyProperty TargetProperty = DependencyProperty.Register(
"Target", typeof(UIElement), typeof(Poptip), new PropertyMetadata(default(UIElement), OnTargetChanged));
private static void OnTargetChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var ctl = (Poptip)d;
ctl.UpdateTarget(ctl._elementTarget, false);
ctl.UpdateTarget((UIElement)e.NewValue, true);
}
[Bindable(true), Category("Layout")]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public UIElement Target
{
get => (UIElement) GetValue(TargetProperty);
set => SetValue(TargetProperty, value);
}
public static readonly DependencyProperty InstanceProperty = DependencyProperty.RegisterAttached(
"Instance", typeof(Poptip), typeof(Poptip), new PropertyMetadata(default(Poptip), OnPoptipChanged));
private static void OnPoptipChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
if (!(d is UIElement target)) return;
var poptip = (Poptip)e.NewValue;
poptip.Target = target;
}
public static void SetInstance(DependencyObject element, Poptip value)
=> element.SetValue(InstanceProperty, value);
public static Poptip GetInstance(DependencyObject element)
=> (Poptip)element.GetValue(InstanceProperty);
public static Poptip Default => new Poptip();
private void UpdateTarget(UIElement element, bool isNew)
{
if (element == null) return;
if (!isNew)
{
element.MouseEnter -= Element_MouseEnter;
element.MouseLeave -= Element_MouseLeave;
element.GotFocus -= Element_GotFocus;
element.LostFocus -= Element_LostFocus;
_elementTarget = null;
}
else
{
element.MouseEnter += Element_MouseEnter;
element.MouseLeave += Element_MouseLeave;
element.GotFocus += Element_GotFocus;
element.LostFocus += Element_LostFocus;
_elementTarget = element;
_popup.PlacementTarget = _elementTarget;
}
}
private void UpdateLocation()
{
var targetWidth = Target.RenderSize.Width;
var targetHeight = Target.RenderSize.Height;
Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
var size = DesiredSize;
var width = size.Width;
var height = size.Height;
var offsetX = .0;
var offsetY = .0;
var poptip = GetInstance(Target);
var popupPlacement = poptip.Placement;
var popupOffset = poptip.Offset;
PlacementMode placementMode;
switch (popupPlacement)
{
case TipPlacement.LeftTop:
offsetX = -popupOffset;
placementMode = PlacementMode.Left;
break;
case TipPlacement.Left:
offsetX = -popupOffset;
offsetY = (targetHeight - height) / 2;
placementMode = PlacementMode.Left;
break;
case TipPlacement.LeftBottom:
offsetX = -popupOffset;
offsetY = targetHeight - height;
placementMode = PlacementMode.Left;
break;
case TipPlacement.TopLeft:
offsetY = -popupOffset;
placementMode = PlacementMode.Top;
break;
case TipPlacement.Top:
offsetX = (targetWidth - width) / 2;
offsetY = -popupOffset;
placementMode = PlacementMode.Top;
break;
case TipPlacement.TopRight:
offsetX = targetWidth - width;
offsetY = -popupOffset;
placementMode = PlacementMode.Top;
break;
case TipPlacement.RightTop:
offsetX = popupOffset;
placementMode = PlacementMode.Right;
break;
case TipPlacement.Right:
offsetX = popupOffset;
offsetY = (targetHeight - height) / 2;
placementMode = PlacementMode.Right;
break;
case TipPlacement.RightBottom:
offsetX = popupOffset;
offsetY = targetHeight - height;
placementMode = PlacementMode.Right;
break;
case TipPlacement.BottomLeft:
offsetY = popupOffset;
placementMode = PlacementMode.Bottom;
break;
case TipPlacement.Bottom:
offsetX = (targetWidth - width) / 2;
offsetY = popupOffset;
placementMode = PlacementMode.Bottom;
break;
case TipPlacement.BottomRight:
offsetX = targetWidth - width;
offsetY = popupOffset;
placementMode = PlacementMode.Bottom;
break;
default:
throw new ArgumentOutOfRangeException();
}
_popup.HorizontalOffset = offsetX;
_popup.VerticalOffset = offsetY;
_popup.Placement = placementMode;
}
private void SwitchPoptip(bool isShow)
{
if (isShow)
{
if (!GetIsInstance(Target))
{
SetCurrentValue(ContentProperty, GetContent(Target));
SetCurrentValue(PlacementProperty, GetPlacement(Target));
SetCurrentValue(HitModeProperty, GetHitMode(Target));
SetCurrentValue(OffsetProperty, GetOffset(Target));
SetCurrentValue(IsOpenProperty, GetIsOpen(Target));
}
_popup.PlacementTarget = Target;
UpdateLocation();
}
_popup.IsOpen = isShow;
Target.SetCurrentValue(IsOpenProperty, isShow);
}
private void Element_MouseEnter(object sender, MouseEventArgs e)
{
var hitMode = GetIsInstance(Target) ? HitMode : GetHitMode(Target);
if (hitMode != HitMode.Hover || hitMode == HitMode.None) return;
SwitchPoptip(true);
}
private void Element_MouseLeave(object sender, MouseEventArgs e)
{
var hitMode = GetIsInstance(Target) ? HitMode : GetHitMode(Target);
if (hitMode != HitMode.Hover || hitMode == HitMode.None) return;
SwitchPoptip(false);
}
private void Element_GotFocus(object sender, RoutedEventArgs e)
{
var hitMode = GetIsInstance(Target) ? HitMode : GetHitMode(Target);
if (hitMode != HitMode.Focus || hitMode == HitMode.None) return;
SwitchPoptip(true);
}
private void Element_LostFocus(object sender, RoutedEventArgs e)
{
var hitMode = GetIsInstance(Target) ? HitMode : GetHitMode(Target);
if (hitMode != HitMode.Focus || hitMode == HitMode.None) return;
SwitchPoptip(false);
}
}
}
@@ -22,9 +22,9 @@ namespace HandyControl.Controls
private RangeTrack _track;
private readonly ToolTip _autoToolTipStart = null;
private readonly System.Windows.Controls.ToolTip _autoToolTipStart = null;
private readonly ToolTip _autoToolTipEnd = null;
private readonly System.Windows.Controls.ToolTip _autoToolTipEnd = null;
private RangeThumb _thumbCurrent;
@@ -448,11 +448,11 @@ namespace HandyControl.Controls
OnThumbDragStarted(isStart ? _autoToolTipStart : _autoToolTipEnd, isStart);
}
private void OnThumbDragStarted(ToolTip toolTip, bool isStart)
private void OnThumbDragStarted(System.Windows.Controls.ToolTip toolTip, bool isStart)
{
if (toolTip == null)
{
toolTip = new ToolTip
toolTip = new System.Windows.Controls.ToolTip
{
Placement = PlacementMode.Custom,
PlacementTarget = isStart ? _track.ThumbStart : _track.ThumbEnd,
@@ -556,7 +556,7 @@ namespace HandyControl.Controls
// Show AutoToolTip if needed
if (AutoToolTipPlacement != AutoToolTipPlacement.None)
{
var toolTip = (isStart ? _autoToolTipStart : _autoToolTipEnd) ?? new ToolTip();
var toolTip = (isStart ? _autoToolTipStart : _autoToolTipEnd) ?? new System.Windows.Controls.ToolTip();
toolTip.Content = GetAutoToolTipNumber(isStart);
@@ -1,8 +1,10 @@
namespace HandyControl.Data.Enum
{
public enum MouseHitMode
public enum HitMode
{
Click,
Hover
Hover,
Focus,
None
}
}
@@ -3,7 +3,64 @@ namespace HandyControl.Data
{
public enum TipPlacement
{
/// <summary>
/// 左上
/// </summary>
LeftTop,
/// <summary>
/// 左
/// </summary>
Left,
/// <summary>
/// 左下
/// </summary>
LeftBottom,
/// <summary>
/// 上左
/// </summary>
TopLeft,
/// <summary>
/// 上
/// </summary>
Top,
/// <summary>
/// 上右
/// </summary>
TopRight,
/// <summary>
/// 右上
/// </summary>
RightTop,
/// <summary>
/// 右
/// </summary>
Right,
/// <summary>
/// 右下
/// </summary>
RightBottom,
/// <summary>
/// 下左
/// </summary>
BottomLeft,
/// <summary>
/// 下
/// </summary>
Bottom,
/// <summary>
/// 下右
/// </summary>
BottomRight,
}
}
@@ -29,6 +29,7 @@
<Compile Include="$(MSBuildThisFileDirectory)Controls\Other\ButtonGroup.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Controls\Other\Card.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Controls\Other\Notification.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Controls\Other\Poptip.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Controls\Other\Sprite.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Controls\Block\ToggleBlock.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Controls\Panel\HoneycombPanel.cs" />
@@ -37,7 +38,7 @@
<Compile Include="$(MSBuildThisFileDirectory)Controls\Slider\RangeSlider\TwoWayRangeBase.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Controls\Block\RunningBlock.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Data\Enum\HatchStyle.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Data\Enum\MouseHitMode.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Data\Enum\HitMode.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Data\Enum\ShowAnimation.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Data\Enum\NotifyIconInfoType.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Interactivity\Commands\CloseWindowCommand.cs" />
@@ -383,6 +384,14 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="$(MSBuildThisFileDirectory)Themes\Styles\Poptip.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="$(MSBuildThisFileDirectory)Themes\Styles\Base\PoptipBaseStyle.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="$(MSBuildThisFileDirectory)Themes\Styles\Base\DividerBaseStyle.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
@@ -10,10 +10,10 @@
<converter:String2VisibilityReConverter x:Key="String2VisibilityReConverter"/>
<BooleanToVisibilityConverter x:Key="Boolean2VisibilityConverter"/>
<converter:TreeViewItemMarginConverter x:Key="TreeViewItemMarginConverter"/>
<converter:Color2HexStrConverter x:Key="Color2HexStrConverter"/>
<converter:Color2HexStringConverter x:Key="Color2HexStringConverter"/>
<converter:Object2BooleanConverter x:Key="Object2BooleanConverter"/>
<converter:Boolean2StrConverter x:Key="Boolean2StrConverter"/>
<converter:Int2StrConverter x:Key="Int2StrConverter"/>
<converter:Boolean2StringConverter x:Key="Boolean2StringConverter"/>
<converter:Int2StringConverter x:Key="Int2StringConverter"/>
<converter:BorderClipConverter x:Key="BorderClipConverter"/>
<converter:BorderCircularClipConverter x:Key="BorderCircularClipConverter"/>
<converter:BorderCircularConverter x:Key="BorderCircularConverter"/>
@@ -200,7 +200,7 @@
<Slider Name="PART_SliderColor" LargeChange="0.01" SmallChange="0.01" Grid.ColumnSpan="2" Value="6" Maximum="6" Background="{StaticResource ColorPickerRainbowBrush}" Margin="2,1,0,0" Grid.Row="0" Grid.Column="2" VerticalAlignment="Top" Style="{StaticResource ColorPickerSlider}" IsMoveToPointEnabled="True"/>
<Slider Name="PART_SliderOpacity" Grid.ColumnSpan="2" IsSnapToTickEnabled="True" Value="{Binding ChannelA,RelativeSource={RelativeSource TemplatedParent},Mode=TwoWay}" Maximum="255" SmallChange="1" Foreground="{TemplateBinding SelectedBrushWithoutOpacity}" Background="{StaticResource ColorPickerOpacityBrush}" Margin="2,0,0,0" Grid.Row="0" Grid.Column="2" VerticalAlignment="Bottom" Style="{StaticResource ColorPickerSlider}" IsMoveToPointEnabled="True"/>
<StackPanel Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="3" Margin="0,14,0,0" VerticalAlignment="Top" Visibility="{Binding ShowList[0],RelativeSource={RelativeSource TemplatedParent},Converter={StaticResource Boolean2VisibilityConverter}}">
<TextBox Padding="0" HorizontalContentAlignment="Center" Width="176" Text="{Binding SelectedBrush,RelativeSource={RelativeSource TemplatedParent},Mode=TwoWay,Converter={StaticResource Color2HexStrConverter},UpdateSourceTrigger=LostFocus}" FontSize="10" MaxLength="10" Height="24" />
<TextBox Padding="0" HorizontalContentAlignment="Center" Width="176" Text="{Binding SelectedBrush,RelativeSource={RelativeSource TemplatedParent},Mode=TwoWay,Converter={StaticResource Color2HexStringConverter},UpdateSourceTrigger=LostFocus}" FontSize="10" MaxLength="10" Height="24" />
<TextBlock Foreground="{DynamicResource ThirdlyTextBrush}" Margin="0,6,0,0" FontSize="10" Text="HEX" HorizontalAlignment="Center"/>
</StackPanel>
<UniformGrid Name="PART_PanelRgb" Visibility="{Binding ShowList[1],RelativeSource={RelativeSource TemplatedParent},Converter={StaticResource Boolean2VisibilityConverter}}" Rows="1" Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="3" Margin="-2,14,-2,0" VerticalAlignment="Top">
@@ -0,0 +1,30 @@
<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">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="../../Basic/Sizes.xaml"/>
</ResourceDictionary.MergedDictionaries>
<Style x:Key="PoptipBaseStyle" TargetType="controls:Poptip">
<Setter Property="IsHitTestVisible" Value="False" />
<Setter Property="HorizontalAlignment" Value="Left"/>
<Setter Property="VerticalAlignment" Value="Top"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Offset" Value="6"/>
<Setter Property="Background" Value="{DynamicResource BackgroundBrush}"/>
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
<Setter Property="controls:BorderElement.CornerRadius" Value="{StaticResource DefaultCornerRadius}"/>
<Setter Property="Padding" Value="{StaticResource DefaultControlPadding}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="controls:Poptip">
<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" CornerRadius="{Binding Path=(controls:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}">
<ContentPresenter Margin="{TemplateBinding Padding}" ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}" ContentStringFormat="{TemplateBinding ContentStringFormat}" ContentTemplate="{TemplateBinding ContentTemplate}"/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
@@ -0,0 +1,12 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:controls="clr-namespace:HandyControl.Controls">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Base/PoptipBaseStyle.xaml"/>
</ResourceDictionary.MergedDictionaries>
<Style BasedOn="{StaticResource PoptipBaseStyle}" TargetType="controls:Poptip">
</Style>
</ResourceDictionary>
@@ -76,6 +76,7 @@
<ResourceDictionary Source="FloatingBlock.xaml"/>
<ResourceDictionary Source="SplitButton.xaml"/>
<ResourceDictionary Source="Divider.xaml"/>
<ResourceDictionary Source="Poptip.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
@@ -1,5 +1,4 @@
<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 TargetType="ToolTip">
@@ -4,7 +4,7 @@ using System.Windows.Data;
namespace HandyControl.Tools.Converter
{
public class Boolean2StrConverter : IValueConverter
public class Boolean2StringConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
@@ -5,7 +5,7 @@ using System.Windows.Media;
namespace HandyControl.Tools.Converter
{
public class Color2HexStrConverter : IValueConverter
public class Color2HexStringConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
@@ -4,24 +4,27 @@ using System.Windows.Data;
namespace HandyControl.Tools.Converter
{
public class Int2StrConverter : IValueConverter
public class Int2StringConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is int intValue)
if (value != null)
{
if (parameter is string str)
if (int.TryParse(value.ToString(), out var intValue))
{
var arr = str.Split(';');
if (arr.Length > intValue)
if (parameter is string str)
{
return arr[intValue];
var arr = str.Split(';');
if (arr.Length > intValue)
{
return arr[intValue];
}
return intValue;
}
return intValue;
}
return intValue;
}
return value;