Skip to content

Commit

Permalink
Replace ImageEx package from WinUI.UI.Control
Browse files Browse the repository at this point in the history
Also added description for legacy WinUI.UI.Controls that eventually needs to be replaced once the replacements are ready
  • Loading branch information
bagusnl committed Nov 13, 2023
1 parent 38282ab commit 849f691
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 9 deletions.
11 changes: 11 additions & 0 deletions CollapseLauncher/CollapseLauncher.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,23 @@
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.2" />
<PackageReference Include="CommunityToolkit.WinUI.Controls.Primitives" Version="8.0.230907" />
<PackageReference Include="CommunityToolkit.WinUI.Media" Version="8.0.230907" />
<!--
TODO:
Remove WinUI.UI.Controls entirely and replace it with equivalent supported packages. This has to be done due to WinUI.UI package is going out-of-support and will not be updated anymore.
List of features linked to this package:
- MarkdownTextBlock (UpdatePage.xaml//UpdatePage.xaml.cs)
https://github.com/CommunityToolkit/Labs-Windows/pull/480 (Still not available as of Nov, 13th 2023)
- DataGrid (DataGrid.xaml//RepairPage.xaml//CachesPage.xaml)
Alt: DataTable (Available in WCT-Labs as experimental as of Nov, 13th 2023)
https://github.com/CommunityToolkit/Labs-Windows/discussions/415
-->
<PackageReference Include="CommunityToolkit.WinUI.UI.Controls" Version="7.1.2" />
<PackageReference Include="GitInfo" Version="3.3.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="H.NotifyIcon.WinUI" Version="2.0.118" />
<PackageReference Include="ImageEx" Version="2.0.0" />
<PackageReference Include="Microsoft.Graphics.Win2D" Version="1.1.0" />
<PackageReference Include="Microsoft.NETCore.Platforms" Version="8.0.0-preview.7.23375.6" />
<PackageReference Include="Microsoft.NETCore.Targets" Version="6.0.0-preview.4.21253.7" />
Expand Down
13 changes: 6 additions & 7 deletions CollapseLauncher/XAMLs/MainApp/Pages/HomePage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
xmlns:localPage="using:CollapseLauncher.Pages"
xmlns:helper="using:Hi3Helper"
xmlns:s="using:CommunityToolkit.WinUI"
xmlns:c="using:CommunityToolkit.WinUI.Controls"
xmlns:control_legacy="using:CommunityToolkit.WinUI.UI.Controls"
xmlns:imageex="using:ImageEx"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:animatedvisuals="using:Microsoft.UI.Xaml.Controls.AnimatedVisuals"
Expand All @@ -18,14 +17,14 @@
<Page.Resources>
<ThemeShadow x:Key="SharedShadow"/>
<s:AttachedDropShadow x:Key="SharedDropShadow" Offset="0,4,0" BlurRadius="16" Opacity="0.3" CastTo="{x:Bind ImageEventImgShadow}"/>
<Style TargetType="control_legacy:ImageEx">
<Style TargetType="imageex:ImageEx">
<Setter Property="Background" Value="Transparent" />
<Setter Property="Foreground" Value="{ThemeResource ApplicationForegroundThemeBrush}" />
<Setter Property="IsTabStop" Value="False" />
<Setter Property="LazyLoadingThreshold" Value="300" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="control_legacy:ImageEx">
<ControlTemplate TargetType="imageex:ImageEx">
<Grid Background="{TemplateBinding Background}"
CornerRadius="{TemplateBinding CornerRadius}"
BorderBrush="{TemplateBinding BorderBrush}"
Expand Down Expand Up @@ -305,8 +304,8 @@
</Storyboard>
</Button.Resources>
<Grid>
<control_legacy:ImageEx x:Name="Icon" Source="{Binding Icon}"/>
<control_legacy:ImageEx x:Name="IconHover" Source="{Binding IconHover}" Opacity="0"/>
<imageex:ImageEx x:Name="Icon" Source="{Binding Icon}"/>
<imageex:ImageEx x:Name="IconHover" Source="{Binding IconHover}" Opacity="0"/>
</Grid>
</Button>
</DataTemplate>
Expand Down Expand Up @@ -337,7 +336,7 @@
PointerExited="CarouselRestartScroll">
<FlipView.ItemTemplate>
<DataTemplate>
<control_legacy:ImageEx IsCacheEnabled="True" EnableLazyLoading="True" PlaceholderSource="ms-appx:///Assets/Images/default.png" Source="{Binding Icon}" Tag="{Binding URL}" ToolTipService.ToolTip="{Binding Description}" PointerPressed="OpenImageLinkFromTag"/>
<imageex:ImageEx IsCacheEnabled="True" EnableLazyLoading="True" PlaceholderSource="ms-appx:///Assets/Images/default.png" Source="{Binding Icon}" Tag="{Binding URL}" ToolTipService.ToolTip="{Binding Description}" PointerPressed="OpenImageLinkFromTag"/>
</DataTemplate>
</FlipView.ItemTemplate>
</FlipView>
Expand Down
3 changes: 1 addition & 2 deletions CollapseLauncher/XAMLs/MainApp/Pages/HomePage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using CollapseLauncher.Interfaces;
using CollapseLauncher.Statics;
using CollapseLauncher.FileDialogCOM;
using CommunityToolkit.WinUI.UI.Controls;
using Hi3Helper;
using Hi3Helper.Preset;
using Hi3Helper.Screen;
Expand Down Expand Up @@ -412,7 +411,7 @@ private async void HideImageEventImg(bool hide)
#region Open Link from Tag
private void OpenImageLinkFromTag(object sender, PointerRoutedEventArgs e)
{
SpawnWebView2.SpawnWebView2Window(((ImageEx)sender).Tag.ToString());
SpawnWebView2.SpawnWebView2Window(((ImageEx.ImageEx)sender).Tag.ToString());
}

private async void OpenButtonLinkFromTag(object sender, RoutedEventArgs e)
Expand Down
9 changes: 9 additions & 0 deletions CollapseLauncher/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,15 @@
"Microsoft.WindowsAppSDK": "1.4.230822000"
}
},
"ImageEx": {
"type": "Direct",
"requested": "[2.0.0, )",
"resolved": "2.0.0",
"contentHash": "kp894Xue0YIflPIao+bEEB65si250ne1sFqDd4aA7pTjQn4TGScuopojx/73vfRKcEsxgclbWjEAlKqGSYqiQA==",
"dependencies": {
"Microsoft.WindowsAppSDK": "1.0.0"
}
},
"Microsoft.Graphics.Win2D": {
"type": "Direct",
"requested": "[1.1.0, )",
Expand Down

0 comments on commit 849f691

Please sign in to comment.