add ImageAttach
This commit is contained in:
1 parent
8e34fc1d29
commit
d9959fab38
21 files changed
+131
-50
No files matched your search
@@ -49,6 +49,9 @@
|
|||||||
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Data\DemoInfo.json">
|
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Data\DemoInfo.json">
|
||||||
<Link>Data\DemoInfo.json</Link>
|
<Link>Data\DemoInfo.json</Link>
|
||||||
</Resource>
|
</Resource>
|
||||||
|
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\chrome_dragon.png">
|
||||||
|
<Link>Resources\Img\chrome_dragon.png</Link>
|
||||||
|
</Resource>
|
||||||
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\Cover.png">
|
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\Cover.png">
|
||||||
<Link>Resources\Img\Cover.png</Link>
|
<Link>Resources\Img\Cover.png</Link>
|
||||||
</Resource>
|
</Resource>
|
||||||
|
|||||||
@@ -49,6 +49,9 @@
|
|||||||
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Data\DemoInfo.json">
|
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Data\DemoInfo.json">
|
||||||
<Link>Data\DemoInfo.json</Link>
|
<Link>Data\DemoInfo.json</Link>
|
||||||
</Resource>
|
</Resource>
|
||||||
|
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\chrome_dragon.png">
|
||||||
|
<Link>Resources\Img\chrome_dragon.png</Link>
|
||||||
|
</Resource>
|
||||||
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\Cover.png">
|
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\Cover.png">
|
||||||
<Link>Resources\Img\Cover.png</Link>
|
<Link>Resources\Img\Cover.png</Link>
|
||||||
</Resource>
|
</Resource>
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 1.9 KiB |
@@ -129,10 +129,11 @@ namespace HandyControlDemo.Service
|
|||||||
Link = item.html_url
|
Link = item.html_url
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
catch
|
catch(Exception e)
|
||||||
{
|
{
|
||||||
// ignored
|
HandyControl.Controls.MessageBox.Error(e.Message, Lang.Error);
|
||||||
}
|
}
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -180,7 +181,7 @@ namespace HandyControlDemo.Service
|
|||||||
new AvatarModel
|
new AvatarModel
|
||||||
{
|
{
|
||||||
DisplayName = "AutumnBox",
|
DisplayName = "AutumnBox",
|
||||||
AvatarUri = "https://www.atmb.top/images/leaves.png",
|
AvatarUri = "https://raw.githubusercontent.com/zsh2401/AutumnBox/master/src/AutumnBox.GUI/Resources/Images/icon.png",
|
||||||
Link = "https://github.com/zsh2401/AutumnBox"
|
Link = "https://github.com/zsh2401/AutumnBox"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
<RowDefinition/>
|
<RowDefinition/>
|
||||||
<RowDefinition Height="Auto"/>
|
<RowDefinition Height="Auto"/>
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<Image Source="{Binding Source,RelativeSource={RelativeSource AncestorType=UserControl}}" Height="120" Width="120" Stretch="Uniform" Margin="10"/>
|
<Image hc:ImageAttach.SourceFailed="/Resources/Img/chrome_dragon.png" 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 DisplayName,RelativeSource={RelativeSource AncestorType=UserControl}}"/>
|
<TextBlock TextTrimming="CharacterEllipsis" TextWrapping="NoWrap" Margin="0,0,0,10" Grid.Row="1" Style="{StaticResource TextBlockDefault}" Text="{Binding DisplayName,RelativeSource={RelativeSource AncestorType=UserControl}}"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Border>
|
</Border>
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
<hc:OutlineText TextWrapping="Wrap" Fill="{DynamicResource PrimaryTextBrush}" Text="{ex:Lang Key={x:Static langs:LangKeys.Text}, Converter={StaticResource StringRepeatConverter}, ConverterParameter=20}"/>
|
<hc:OutlineText TextWrapping="Wrap" Fill="{DynamicResource PrimaryTextBrush}" Text="{ex:Lang Key={x:Static langs:LangKeys.Text}, Converter={StaticResource StringRepeatConverter}, ConverterParameter=20}"/>
|
||||||
<hc:OutlineText Margin="0,10,0,0" FontSize="30" Fill="{DynamicResource SuccessBrush}" Text="{ex:Lang Key={x:Static langs:LangKeys.Text}, Converter={StaticResource StringRepeatConverter}, ConverterParameter=8}"/>
|
<hc:OutlineText Margin="0,10,0,0" FontSize="30" Fill="{DynamicResource SuccessBrush}" Text="{ex:Lang Key={x:Static langs:LangKeys.Text}, Converter={StaticResource StringRepeatConverter}, ConverterParameter=8}"/>
|
||||||
<hc:OutlineText Margin="0,10,0,0" Fill="{DynamicResource PrimaryTextBrush}" FontSize="30" FontStyle="Italic" Text="{ex:Lang Key={x:Static langs:LangKeys.Text}, Converter={StaticResource StringRepeatConverter}, ConverterParameter=8}"/>
|
<hc:OutlineText Margin="0,10,0,0" Fill="{DynamicResource PrimaryTextBrush}" FontSize="30" FontStyle="Italic" Text="{ex:Lang Key={x:Static langs:LangKeys.Text}, Converter={StaticResource StringRepeatConverter}, ConverterParameter=8}"/>
|
||||||
<hc:OutlineText Margin="0,10,0,0" TextWrapping="Wrap" TextTrimming="CharacterEllipsis" FontSize="50" StrokeThickness="2" Fill="{DynamicResource DangerBrush}" Stroke="{DynamicResource PrimaryBrush}" Text="ex:Lang Key={x:Static langs:LangKeys.Text}, Converter={StaticResource StringRepeatConverter}, ConverterParameter=5}"/>
|
<hc:OutlineText Margin="0,10,0,0" TextWrapping="Wrap" TextTrimming="CharacterEllipsis" FontSize="50" StrokeThickness="2" Fill="{DynamicResource DangerBrush}" Stroke="{DynamicResource PrimaryBrush}" Text="{ex:Lang Key={x:Static langs:LangKeys.Text}, Converter={StaticResource StringRepeatConverter}, ConverterParameter=5}"/>
|
||||||
<hc:OutlineText Margin="0,10,0,0" FontSize="80" FontWeight="Bold" StrokeThickness="4" Fill="{DynamicResource PrimaryBrush}" Stroke="{DynamicResource DangerBrush}" Text="{ex:Lang Key={x:Static langs:LangKeys.Text}, Converter={StaticResource StringRepeatConverter}, ConverterParameter=2}"/>
|
<hc:OutlineText Margin="0,10,0,0" FontSize="80" FontWeight="Bold" StrokeThickness="4" Fill="{DynamicResource PrimaryBrush}" Stroke="{DynamicResource DangerBrush}" Text="{ex:Lang Key={x:Static langs:LangKeys.Text}, Converter={StaticResource StringRepeatConverter}, ConverterParameter=2}"/>
|
||||||
<hc:OutlineText Margin="0,10,0,0" StrokePosition="Outside" FontSize="80" FontWeight="Bold" StrokeThickness="4" Fill="{DynamicResource PrimaryBrush}" Stroke="{DynamicResource DangerBrush}" Text="{ex:Lang Key={x:Static langs:LangKeys.Text}, Converter={StaticResource StringRepeatConverter}, ConverterParameter=2}"/>
|
<hc:OutlineText Margin="0,10,0,0" StrokePosition="Outside" FontSize="80" FontWeight="Bold" StrokeThickness="4" Fill="{DynamicResource PrimaryBrush}" Stroke="{DynamicResource DangerBrush}" Text="{ex:Lang Key={x:Static langs:LangKeys.Text}, Converter={StaticResource StringRepeatConverter}, ConverterParameter=2}"/>
|
||||||
<hc:OutlineText Margin="0,10,0,0" StrokePosition="InSide" FontSize="80" FontWeight="Bold" StrokeThickness="4" Fill="{DynamicResource PrimaryBrush}" Stroke="{DynamicResource DangerBrush}" Text="{ex:Lang Key={x:Static langs:LangKeys.Text}, Converter={StaticResource StringRepeatConverter}, ConverterParameter=2}"/>
|
<hc:OutlineText Margin="0,10,0,0" StrokePosition="InSide" FontSize="80" FontWeight="Bold" StrokeThickness="4" Fill="{DynamicResource PrimaryBrush}" Stroke="{DynamicResource DangerBrush}" Text="{ex:Lang Key={x:Static langs:LangKeys.Text}, Converter={StaticResource StringRepeatConverter}, ConverterParameter=2}"/>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||||
DataContext="{Binding BlogsView,Source={StaticResource Locator}}"
|
DataContext="{Binding BlogsView,Source={StaticResource Locator}}"
|
||||||
Background="{DynamicResource SecondaryRegionBrush}">
|
Background="{DynamicResource SecondaryRegionBrush}">
|
||||||
<hc:Watermark Mark="Blog" FontSize="80" MarkMargin="30,0">
|
<hc:Watermark Mark="Blog" FontSize="80" FontWeight="Bold" MarkMargin="30,0">
|
||||||
<ListBox Background="Transparent" ItemContainerStyle="{StaticResource ListBoxItemCustom}" BorderThickness="0" ItemsSource="{Binding DataList}" ItemsPanel="{StaticResource FluidMoveBehaviorWrapPanelItemsPanelTemplate}">
|
<ListBox Background="Transparent" ItemContainerStyle="{StaticResource ListBoxItemCustom}" BorderThickness="0" ItemsSource="{Binding DataList}" ItemsPanel="{StaticResource FluidMoveBehaviorWrapPanelItemsPanelTemplate}">
|
||||||
<ListBox.ItemTemplate>
|
<ListBox.ItemTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
|
|||||||
@@ -5,13 +5,20 @@
|
|||||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||||
DataContext="{Binding ContributorsView,Source={StaticResource Locator}}"
|
DataContext="{Binding ContributorsView,Source={StaticResource Locator}}"
|
||||||
Background="{DynamicResource SecondaryRegionBrush}">
|
Background="{DynamicResource SecondaryRegionBrush}">
|
||||||
<hc:Watermark Mark="{StaticResource GitHubStrGeometry}" MarkMargin="30,0" MarkWidth="200" MarkHeight="100">
|
<hc:Watermark FontWeight="Bold" Mark="{StaticResource GitHubStrGeometry}" MarkMargin="30,0" MarkWidth="200" MarkHeight="100">
|
||||||
<ListBox Background="Transparent" ItemContainerStyle="{StaticResource ListBoxItemCustom}" BorderThickness="0" ItemsSource="{Binding DataList}" ItemsPanel="{StaticResource FluidMoveBehaviorWrapPanelItemsPanelTemplate}">
|
<hc:ToggleBlock IsChecked="{Binding DataGot}" VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch">
|
||||||
<ListBox.ItemTemplate>
|
<hc:ToggleBlock.UnCheckedContent>
|
||||||
<DataTemplate>
|
<hc:LoadingCircle IsRunning="{Binding DataGot,Converter={StaticResource Boolean2BooleanReConverter}}"/>
|
||||||
<userControl:Avatar DisplayName="{Binding DisplayName}" Link="{Binding Link}" Source="{Binding AvatarUri}"/>
|
</hc:ToggleBlock.UnCheckedContent>
|
||||||
</DataTemplate>
|
<hc:ToggleBlock.CheckedContent>
|
||||||
</ListBox.ItemTemplate>
|
<ListBox Background="Transparent" ItemContainerStyle="{StaticResource ListBoxItemCustom}" BorderThickness="0" ItemsSource="{Binding DataList}" ItemsPanel="{StaticResource FluidMoveBehaviorWrapPanelItemsPanelTemplate}">
|
||||||
</ListBox>
|
<ListBox.ItemTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<userControl:Avatar DisplayName="{Binding DisplayName}" Link="{Binding Link}" Source="{Binding AvatarUri}"/>
|
||||||
|
</DataTemplate>
|
||||||
|
</ListBox.ItemTemplate>
|
||||||
|
</ListBox>
|
||||||
|
</hc:ToggleBlock.CheckedContent>
|
||||||
|
</hc:ToggleBlock>
|
||||||
</hc:Watermark>
|
</hc:Watermark>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
xmlns:langs="clr-namespace:HandyControlDemo.Properties.Langs"
|
xmlns:langs="clr-namespace:HandyControlDemo.Properties.Langs"
|
||||||
xmlns:ex="clr-namespace:HandyControlDemo.Tools.Extension"
|
xmlns:ex="clr-namespace:HandyControlDemo.Tools.Extension"
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
Margin="16"
|
Margin="16,16,0,16"
|
||||||
CornerRadius="10"
|
CornerRadius="10"
|
||||||
Effect="{StaticResource EffectShadow4}">
|
Effect="{StaticResource EffectShadow4}">
|
||||||
<Border.Resources>
|
<Border.Resources>
|
||||||
|
|||||||
@@ -2,23 +2,28 @@
|
|||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||||
x:Class="HandyControlDemo.UserControl.MainContent">
|
x:Class="HandyControlDemo.UserControl.MainContent">
|
||||||
<Grid Name="GridMain" MinHeight="300" MinWidth="200" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="16">
|
<hc:SimplePanel>
|
||||||
<Grid.RowDefinitions>
|
<Border Name="BorderRootEffect" Background="{DynamicResource RegionBrush}" CornerRadius="10" Effect="{StaticResource EffectShadow4}" Margin="16" Visibility="Collapsed"/>
|
||||||
<RowDefinition Height="Auto"/>
|
<Border Name="BorderRoot" Style="{StaticResource BorderClip}" Margin="16">
|
||||||
<RowDefinition/>
|
<Grid Name="GridMain" MinHeight="300" MinWidth="200" HorizontalAlignment="Center" VerticalAlignment="Center">
|
||||||
</Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<Border Name="BorderEffect" Grid.RowSpan="2" Background="{DynamicResource RegionBrush}" CornerRadius="10" Effect="{StaticResource EffectShadow4}"/>
|
<RowDefinition Height="Auto"/>
|
||||||
<Border Height="32" Name="BorderTitle" Grid.Row="0" CornerRadius="10,10,0,0" Background="{DynamicResource TitleBrush}">
|
<RowDefinition/>
|
||||||
<hc:SimplePanel>
|
</Grid.RowDefinitions>
|
||||||
<TextBlock Style="{StaticResource TextBlockDefault}" Foreground="White" Text="{Binding ContentTitle}"/>
|
<Border Name="BorderEffect" Grid.RowSpan="2" Background="{DynamicResource RegionBrush}" CornerRadius="10" Effect="{StaticResource EffectShadow4}"/>
|
||||||
<ToggleButton Margin="0,0,6,0" IsChecked="{Binding IsOpen,ElementName=DrawerCode}" Padding="5" Foreground="{DynamicResource TextIconBrush}" Style="{StaticResource ToggleButtonIconTransparent}" HorizontalAlignment="Right" hc:IconElement.Geometry="{StaticResource CodeGeometry}"/>
|
<Border Height="32" Name="BorderTitle" Grid.Row="0" CornerRadius="10,10,0,0" Background="{DynamicResource TitleBrush}">
|
||||||
<hc:Drawer Name="DrawerCode" Opened="DrawerCode_OnOpened">
|
<hc:SimplePanel>
|
||||||
<Border Style="{StaticResource BorderClip}" Margin="32,32,0,32" CornerRadius="10,0,0,10" Background="{DynamicResource RegionBrush}" Width="800" Name="BorderCode"/>
|
<TextBlock Style="{StaticResource TextBlockDefault}" Foreground="White" Text="{Binding ContentTitle}"/>
|
||||||
</hc:Drawer>
|
<ToggleButton Margin="0,0,6,0" IsChecked="{Binding IsOpen,ElementName=DrawerCode}" Padding="5" Foreground="{DynamicResource TextIconBrush}" Style="{StaticResource ToggleButtonIconTransparent}" HorizontalAlignment="Right" hc:IconElement.Geometry="{StaticResource CodeGeometry}"/>
|
||||||
</hc:SimplePanel>
|
<hc:Drawer Name="DrawerCode" Opened="DrawerCode_OnOpened">
|
||||||
|
<Border Style="{StaticResource BorderClip}" Margin="32,32,0,32" CornerRadius="10,0,0,10" Background="{DynamicResource RegionBrush}" Width="800" Name="BorderCode"/>
|
||||||
|
</hc:Drawer>
|
||||||
|
</hc:SimplePanel>
|
||||||
|
</Border>
|
||||||
|
<Border Grid.Row="1" ClipToBounds="True">
|
||||||
|
<ContentPresenter Name="PresenterMain" Margin="0,0,0,10" Content="{Binding SubContent}"/>
|
||||||
|
</Border>
|
||||||
|
</Grid>
|
||||||
</Border>
|
</Border>
|
||||||
<Border Grid.Row="1" ClipToBounds="True">
|
</hc:SimplePanel>
|
||||||
<ContentPresenter Name="PresenterMain" Margin="0,0,0,10" Content="{Binding SubContent}"/>
|
|
||||||
</Border>
|
|
||||||
</Grid>
|
|
||||||
</Border>
|
</Border>
|
||||||
@@ -38,21 +38,25 @@ namespace HandyControlDemo.UserControl
|
|||||||
_isFull = isFull;
|
_isFull = isFull;
|
||||||
if (_isFull)
|
if (_isFull)
|
||||||
{
|
{
|
||||||
|
BorderRootEffect.Show();
|
||||||
BorderEffect.Collapse();
|
BorderEffect.Collapse();
|
||||||
BorderTitle.Collapse();
|
BorderTitle.Collapse();
|
||||||
GridMain.HorizontalAlignment = HorizontalAlignment.Stretch;
|
GridMain.HorizontalAlignment = HorizontalAlignment.Stretch;
|
||||||
GridMain.VerticalAlignment = VerticalAlignment.Stretch;
|
GridMain.VerticalAlignment = VerticalAlignment.Stretch;
|
||||||
GridMain.Margin = new Thickness();
|
|
||||||
PresenterMain.Margin = new Thickness();
|
PresenterMain.Margin = new Thickness();
|
||||||
|
BorderRoot.CornerRadius = new CornerRadius(10);
|
||||||
|
BorderRoot.Style = ResourceHelper.GetResource<Style>("BorderClip");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
BorderRootEffect.Collapse();
|
||||||
BorderEffect.Show();
|
BorderEffect.Show();
|
||||||
BorderTitle.Show();
|
BorderTitle.Show();
|
||||||
GridMain.HorizontalAlignment = HorizontalAlignment.Center;
|
GridMain.HorizontalAlignment = HorizontalAlignment.Center;
|
||||||
GridMain.VerticalAlignment = VerticalAlignment.Center;
|
GridMain.VerticalAlignment = VerticalAlignment.Center;
|
||||||
GridMain.Margin = new Thickness(16);
|
|
||||||
PresenterMain.Margin = new Thickness(0, 0, 0, 10);
|
PresenterMain.Margin = new Thickness(0, 0, 0, 10);
|
||||||
|
BorderRoot.CornerRadius = new CornerRadius();
|
||||||
|
BorderRoot.Style = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,8 @@
|
|||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008">
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:userControl="clr-namespace:HandyControlDemo.UserControl"
|
||||||
|
Background="{DynamicResource SecondaryRegionBrush}">
|
||||||
|
<userControl:UnderConstruction VerticalAlignment="Center" HorizontalAlignment="Center"/>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
@@ -5,7 +5,7 @@
|
|||||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||||
DataContext="{Binding ProjectsView,Source={StaticResource Locator}}"
|
DataContext="{Binding ProjectsView,Source={StaticResource Locator}}"
|
||||||
Background="{DynamicResource SecondaryRegionBrush}">
|
Background="{DynamicResource SecondaryRegionBrush}">
|
||||||
<hc:Watermark Mark="Project" FontSize="80" MarkMargin="30,0">
|
<hc:Watermark Mark="Project" FontSize="80" FontWeight="Bold" MarkMargin="30,0">
|
||||||
<ListBox Background="Transparent" ItemContainerStyle="{StaticResource ListBoxItemCustom}" BorderThickness="0" ItemsSource="{Binding DataList}" ItemsPanel="{StaticResource FluidMoveBehaviorWrapPanelItemsPanelTemplate}">
|
<ListBox Background="Transparent" ItemContainerStyle="{StaticResource ListBoxItemCustom}" BorderThickness="0" ItemsSource="{Binding DataList}" ItemsPanel="{StaticResource FluidMoveBehaviorWrapPanelItemsPanelTemplate}">
|
||||||
<ListBox.ItemTemplate>
|
<ListBox.ItemTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||||
DataContext="{Binding WebsitesView,Source={StaticResource Locator}}"
|
DataContext="{Binding WebsitesView,Source={StaticResource Locator}}"
|
||||||
Background="{DynamicResource SecondaryRegionBrush}">
|
Background="{DynamicResource SecondaryRegionBrush}">
|
||||||
<hc:Watermark Mark="Website" FontSize="80" MarkMargin="30,0">
|
<hc:Watermark Mark="Website" FontSize="80" FontWeight="Bold" MarkMargin="30,0">
|
||||||
<ListBox Background="Transparent" ItemContainerStyle="{StaticResource ListBoxItemCustom}" BorderThickness="0" ItemsSource="{Binding DataList}" ItemsPanel="{StaticResource FluidMoveBehaviorWrapPanelItemsPanelTemplate}">
|
<ListBox Background="Transparent" ItemContainerStyle="{StaticResource ListBoxItemCustom}" BorderThickness="0" ItemsSource="{Binding DataList}" ItemsPanel="{StaticResource FluidMoveBehaviorWrapPanelItemsPanelTemplate}">
|
||||||
<ListBox.ItemTemplate>
|
<ListBox.ItemTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
|
|||||||
@@ -7,12 +7,24 @@ namespace HandyControlDemo.ViewModel
|
|||||||
{
|
{
|
||||||
public class ItemsDisplayViewModel : DemoViewModelBase<AvatarModel>
|
public class ItemsDisplayViewModel : DemoViewModelBase<AvatarModel>
|
||||||
{
|
{
|
||||||
public ItemsDisplayViewModel(Func<List<AvatarModel>> getDatAction)
|
public ItemsDisplayViewModel(Func<List<AvatarModel>> getDataAction)
|
||||||
{
|
{
|
||||||
#if NET40
|
#if !NET40
|
||||||
Task.Factory.StartNew(() => DataList = getDatAction?.Invoke());
|
Task.Factory.StartNew(() => DataList = getDataAction?.Invoke()).ContinueWith(obj => DataGot = true);
|
||||||
#else
|
#else
|
||||||
Task.Run(() => DataList = getDatAction?.Invoke());
|
Task.Run(() => DataList = getDataAction?.Invoke()).ContinueWith(obj => DataGot = true);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool _dataGot;
|
||||||
|
|
||||||
|
public bool DataGot
|
||||||
|
{
|
||||||
|
get => _dataGot;
|
||||||
|
#if NET40
|
||||||
|
set => Set(nameof(DataGot), ref _dataGot, value);
|
||||||
|
#else
|
||||||
|
set => Set(ref _dataGot, value);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -176,8 +176,8 @@ namespace HandyControlDemo.ViewModel
|
|||||||
private void OpenPracticalDemo()
|
private void OpenPracticalDemo()
|
||||||
{
|
{
|
||||||
Messenger.Default.Send<object>(null, MessageToken.ClearLeftSelected);
|
Messenger.Default.Send<object>(null, MessageToken.ClearLeftSelected);
|
||||||
Messenger.Default.Send(true, MessageToken.FullSwitch);
|
|
||||||
Messenger.Default.Send(AssemblyHelper.CreateInternalInstance($"UserControl.{MessageToken.PracticalDemo}"), MessageToken.LoadShowContent);
|
Messenger.Default.Send(AssemblyHelper.CreateInternalInstance($"UserControl.{MessageToken.PracticalDemo}"), MessageToken.LoadShowContent);
|
||||||
|
Messenger.Default.Send(true, MessageToken.FullSwitch);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ namespace HandyControlDemo.ViewModel
|
|||||||
SimpleIoc.Default.Register<ImageBrowserDemoViewModel>();
|
SimpleIoc.Default.Register<ImageBrowserDemoViewModel>();
|
||||||
SimpleIoc.Default.Register<ComboBoxDemoViewModel>();
|
SimpleIoc.Default.Register<ComboBoxDemoViewModel>();
|
||||||
SimpleIoc.Default.Register<WindowDemoViewModel>();
|
SimpleIoc.Default.Register<WindowDemoViewModel>();
|
||||||
SimpleIoc.Default.Register(() => new ItemsDisplayViewModel(dataService.GetContributorDataList), "Contributors");
|
|
||||||
SimpleIoc.Default.Register(() => new ItemsDisplayViewModel(dataService.GetBlogDataList), "Blogs");
|
SimpleIoc.Default.Register(() => new ItemsDisplayViewModel(dataService.GetBlogDataList), "Blogs");
|
||||||
SimpleIoc.Default.Register(() => new ItemsDisplayViewModel(dataService.GetProjectDataList), "Projects");
|
SimpleIoc.Default.Register(() => new ItemsDisplayViewModel(dataService.GetProjectDataList), "Projects");
|
||||||
SimpleIoc.Default.Register(() => new ItemsDisplayViewModel(dataService.GetWebsiteDataList), "Websites");
|
SimpleIoc.Default.Register(() => new ItemsDisplayViewModel(dataService.GetWebsiteDataList), "Websites");
|
||||||
@@ -58,7 +57,7 @@ namespace HandyControlDemo.ViewModel
|
|||||||
|
|
||||||
public WindowDemoViewModel WindowDemo => SimpleIoc.Default.GetInstance<WindowDemoViewModel>();
|
public WindowDemoViewModel WindowDemo => SimpleIoc.Default.GetInstance<WindowDemoViewModel>();
|
||||||
|
|
||||||
public ItemsDisplayViewModel ContributorsView => SimpleIoc.Default.GetInstance<ItemsDisplayViewModel>("Contributors");
|
public ItemsDisplayViewModel ContributorsView => new ItemsDisplayViewModel(SimpleIoc.Default.GetInstance<DataService>().GetContributorDataList);
|
||||||
|
|
||||||
public ItemsDisplayViewModel BlogsView => SimpleIoc.Default.GetInstance<ItemsDisplayViewModel>("Blogs");
|
public ItemsDisplayViewModel BlogsView => SimpleIoc.Default.GetInstance<ItemsDisplayViewModel>("Blogs");
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,42 @@
|
|||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Media;
|
||||||
|
|
||||||
|
namespace HandyControl.Controls
|
||||||
|
{
|
||||||
|
public class ImageAttach
|
||||||
|
{
|
||||||
|
public static readonly DependencyProperty SourceFailedProperty = DependencyProperty.RegisterAttached(
|
||||||
|
"SourceFailed", typeof(ImageSource), typeof(ImageAttach), new FrameworkPropertyMetadata(default(ImageSource), FrameworkPropertyMetadataOptions.Inherits, OnSourceFailedChanged));
|
||||||
|
|
||||||
|
private static void OnSourceFailedChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||||
|
{
|
||||||
|
if (d is Image image)
|
||||||
|
{
|
||||||
|
if (e.NewValue is ImageSource)
|
||||||
|
{
|
||||||
|
image.ImageFailed += Image_ImageFailed;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
image.ImageFailed -= Image_ImageFailed;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void Image_ImageFailed(object sender, ExceptionRoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if (sender is Image image)
|
||||||
|
{
|
||||||
|
image.SetCurrentValue(Image.SourceProperty, GetSourceFailed(image));
|
||||||
|
image.ImageFailed -= Image_ImageFailed;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void SetSourceFailed(DependencyObject element, ImageSource value)
|
||||||
|
=> element.SetValue(SourceFailedProperty, value);
|
||||||
|
|
||||||
|
public static ImageSource GetSourceFailed(DependencyObject element)
|
||||||
|
=> (ImageSource) element.GetValue(SourceFailedProperty);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -8,9 +8,6 @@ namespace HandyControl.Controls
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 切换块
|
/// 切换块
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>
|
|
||||||
/// 在不需要命中测试的情况下可代替ToggleButton或CheckBox,以减少内存用量。
|
|
||||||
/// </remarks>
|
|
||||||
public class ToggleBlock : Control
|
public class ToggleBlock : Control
|
||||||
{
|
{
|
||||||
public static readonly DependencyProperty IsCheckedProperty = DependencyProperty.Register(
|
public static readonly DependencyProperty IsCheckedProperty = DependencyProperty.Register(
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
<Compile Include="$(MSBuildThisFileDirectory)Controls\Attach\EdgeElement.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Controls\Attach\EdgeElement.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Controls\Attach\IconElement.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Controls\Attach\IconElement.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Controls\Attach\IconSwitchElement.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Controls\Attach\IconSwitchElement.cs" />
|
||||||
|
<Compile Include="$(MSBuildThisFileDirectory)Controls\Attach\ImageAttach.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Controls\Attach\InfoElement.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Controls\Attach\InfoElement.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Controls\Attach\MenuTopLineAttach.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Controls\Attach\MenuTopLineAttach.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Controls\Attach\PanelElement.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Controls\Attach\PanelElement.cs" />
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
xmlns:controls="clr-namespace:HandyControl.Controls">
|
xmlns:controls="clr-namespace:HandyControl.Controls">
|
||||||
|
|
||||||
<Style x:Key="ToggleBlockBaseStyle" TargetType="controls:ToggleBlock">
|
<Style x:Key="ToggleBlockBaseStyle" TargetType="controls:ToggleBlock">
|
||||||
<Setter Property="IsHitTestVisible" Value="False"/>
|
|
||||||
<Setter Property="VerticalContentAlignment" Value="Center"/>
|
<Setter Property="VerticalContentAlignment" Value="Center"/>
|
||||||
<Setter Property="HorizontalContentAlignment" Value="Center"/>
|
<Setter Property="HorizontalContentAlignment" Value="Center"/>
|
||||||
<Setter Property="Template">
|
<Setter Property="Template">
|
||||||
@@ -19,11 +18,17 @@
|
|||||||
<ControlTemplate.Triggers>
|
<ControlTemplate.Triggers>
|
||||||
<Trigger Property="IsChecked" Value="True">
|
<Trigger Property="IsChecked" Value="True">
|
||||||
<Setter TargetName="ContentPresenterChecked" Property="Visibility" Value="Visible"/>
|
<Setter TargetName="ContentPresenterChecked" Property="Visibility" Value="Visible"/>
|
||||||
|
<Setter TargetName="ContentPresenterUnChecked" Property="Visibility" Value="Collapsed"/>
|
||||||
|
<Setter TargetName="ContentPresenterIndeterminate" Property="Visibility" Value="Collapsed"/>
|
||||||
</Trigger>
|
</Trigger>
|
||||||
<Trigger Property="IsChecked" Value="False">
|
<Trigger Property="IsChecked" Value="False">
|
||||||
|
<Setter TargetName="ContentPresenterChecked" Property="Visibility" Value="Collapsed"/>
|
||||||
<Setter TargetName="ContentPresenterUnChecked" Property="Visibility" Value="Visible"/>
|
<Setter TargetName="ContentPresenterUnChecked" Property="Visibility" Value="Visible"/>
|
||||||
|
<Setter TargetName="ContentPresenterIndeterminate" Property="Visibility" Value="Collapsed"/>
|
||||||
</Trigger>
|
</Trigger>
|
||||||
<Trigger Property="IsChecked" Value="{x:Null}">
|
<Trigger Property="IsChecked" Value="{x:Null}">
|
||||||
|
<Setter TargetName="ContentPresenterChecked" Property="Visibility" Value="Collapsed"/>
|
||||||
|
<Setter TargetName="ContentPresenterUnChecked" Property="Visibility" Value="Collapsed"/>
|
||||||
<Setter TargetName="ContentPresenterIndeterminate" Property="Visibility" Value="Visible"/>
|
<Setter TargetName="ContentPresenterIndeterminate" Property="Visibility" Value="Visible"/>
|
||||||
</Trigger>
|
</Trigger>
|
||||||
</ControlTemplate.Triggers>
|
</ControlTemplate.Triggers>
|
||||||
|
|||||||
Reference in new issue
Block a user