Separate version

This commit is contained in:
NaBian committed 2019-01-21 11:12:38 +08:00
1 parent a2574dc955
commit db61ae9567
587 files changed
+44639 -657

No files matched your search

@@ -0,0 +1,22 @@
<UserControl x:Class="HandyControlDemo.UserControl.Avatar"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
Margin="16"
Effect="{StaticResource EffectShadow5}"
Cursor="Hand"
mc:Ignorable="d">
<Button Style="{StaticResource ButtonCustom}" Click="ButtonAvatar_OnClick">
<Border Background="{DynamicResource SecondaryRegionBrush}" CornerRadius="10">
<Grid>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Image Source="{Binding Source,RelativeSource={RelativeSource AncestorType=UserControl}}" Height="120" Width="120" Stretch="Uniform" Margin="10"/>
<TextBlock TextTrimming="CharacterEllipsis" TextWrapping="NoWrap" Margin="0,0,0,10" Grid.Row="1" Style="{StaticResource TextBlockDefault}" Text="{Binding UserName,RelativeSource={RelativeSource AncestorType=UserControl}}"></TextBlock>
</Grid>
</Border>
</Button>
</UserControl>
@@ -0,0 +1,44 @@
using System.Diagnostics;
using System.Windows;
using System.Windows.Media.Imaging;
namespace HandyControlDemo.UserControl
{
public partial class Avatar
{
public Avatar()
{
InitializeComponent();
}
public static readonly DependencyProperty SourceProperty = DependencyProperty.Register(
"Source", typeof(BitmapFrame), typeof(Avatar), new PropertyMetadata(default(BitmapFrame)));
public BitmapFrame Source
{
get => (BitmapFrame) GetValue(SourceProperty);
set => SetValue(SourceProperty, value);
}
public static readonly DependencyProperty UserNameProperty = DependencyProperty.Register(
"UserName", typeof(string), typeof(Avatar), new PropertyMetadata(default(string)));
public string UserName
{
get => (string) GetValue(UserNameProperty);
set => SetValue(UserNameProperty, value);
}
public static readonly DependencyProperty LinkProperty = DependencyProperty.Register(
"Link", typeof(string), typeof(Avatar), new PropertyMetadata(default(string)));
public string Link
{
get => (string) GetValue(LinkProperty);
set => SetValue(LinkProperty, value);
}
private void ButtonAvatar_OnClick(object sender, RoutedEventArgs e) => Process.Start(Link);
}
}