Skip to content

Move to iNKORE.UI.WPF.Modern UI Framework #3593

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 28 commits into
base: dev
Choose a base branch
from
Draft
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
0244d86
Make converters be public
Jack251970 May 29, 2025
647a1c7
Add converters from ModernWPF
Jack251970 May 29, 2025
aefce9f
Add helper from ModernWPF
Jack251970 May 29, 2025
6ef2022
Use iNKORE.UI.WPF.Modern package
Jack251970 May 29, 2025
090a5ff
Use scrollviewerex
Jack251970 May 29, 2025
17ac4df
Remove blank lines
Jack251970 May 31, 2025
ec13be9
Merge branch 'dev' into ui_wpf_modern
Jack251970 Jun 6, 2025
8f4d914
Merge branch 'dev' into ui_wpf_modern
Jack251970 Jun 13, 2025
4e70ad6
Fix build issue
Jack251970 Jun 14, 2025
9fb12ea
Fix build issue
Jack251970 Jun 14, 2025
8b572de
Merge branch 'dev' into ui_wpf_modern
Jack251970 Jun 28, 2025
c04db06
Merge branch 'dev' into ui_wpf_modern
Jack251970 Jul 5, 2025
fdb7307
Fix build issue
Jack251970 Jul 5, 2025
b9737bb
Fix build issue
Jack251970 Jul 5, 2025
69ff18d
Merge branch 'dev' into ui_wpf_modern
Jack251970 Jul 10, 2025
0053ada
Merge branch 'dev' into ui_wpf_modern
Jack251970 Jul 14, 2025
abc1b48
Merge branch 'dev' into ui_wpf_modern
Jack251970 Jul 19, 2025
156bd06
Enable GPU for setting window
Jack251970 Jul 19, 2025
ad1d8a9
Merge branch 'dev' into ui_wpf_modern
Jack251970 Jul 19, 2025
935b58a
Remove unused usings
Jack251970 Jul 19, 2025
97917d5
Merge branch 'dev' into ui_wpf_modern
Jack251970 Jul 19, 2025
203c3bd
Merge branch 'dev' into ui_wpf_modern
Jack251970 Jul 20, 2025
7c8dcab
Improve code quality
Jack251970 Jul 22, 2025
36db183
Use ScrollViewerEx for smooth scroll
Jack251970 Jul 22, 2025
8a0139b
Unify CanContentScroll design
Jack251970 Jul 22, 2025
4014f87
Merge branch 'dev' into ui_wpf_modern
Jack251970 Jul 22, 2025
bfc1ebf
Merge branch 'dev' into ui_wpf_modern
Jack251970 Jul 24, 2025
d72240d
Merge branch 'dev' into ui_wpf_modern
Jack251970 Jul 27, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Flow.Launcher/App.xaml
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
x:Class="Flow.Launcher.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:ui="http://schemas.modernwpf.com/2019"
xmlns:ui="http://schemas.inkore.net/lib/ui/wpf/modern"
ShutdownMode="OnMainWindowClose"
Startup="OnStartup">
<Application.Resources>
4 changes: 4 additions & 0 deletions Flow.Launcher/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -22,6 +22,7 @@
using Flow.Launcher.Plugin;
using Flow.Launcher.SettingPages.ViewModels;
using Flow.Launcher.ViewModel;
using iNKORE.UI.WPF.Modern.Common;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.VisualStudio.Threading;
@@ -55,6 +56,9 @@

public App()
{
// Do not use bitmap cache since it can cause WPF second window freezing issue
ShadowAssist.UseBitmapCache = false;

// Initialize settings
_settings.WMPInstalled = WindowsMediaPlayerHelper.IsWindowsMediaPlayerInstalled();

@@ -223,7 +227,7 @@
// Update plugin titles after plugins are initialized with their api instances
Internationalization.UpdatePluginMetadataTranslations();

await imageLoadertask;

Check warning on line 230 in Flow.Launcher/App.xaml.cs

GitHub Actions / Check Spelling

`Loadertask` is not a recognized word. (unrecognized-spelling)

_mainWindow = new MainWindow();

4 changes: 2 additions & 2 deletions Flow.Launcher/Converters/BoolToIMEConversionModeConverter.cs
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@

namespace Flow.Launcher.Converters;

internal class BoolToIMEConversionModeConverter : IValueConverter
public class BoolToIMEConversionModeConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
@@ -22,7 +22,7 @@ public object ConvertBack(object value, Type targetType, object parameter, Cultu
}
}

internal class BoolToIMEStateConverter : IValueConverter
public class BoolToIMEStateConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
91 changes: 91 additions & 0 deletions Flow.Launcher/Converters/CornerRadiusFilterConverter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;

namespace Flow.Launcher.Converters;

public class CornerRadiusFilterConverter : DependencyObject, IValueConverter
{
public CornerRadiusFilterKind Filter { get; set; }

public double Scale { get; set; } = 1.0;

public static CornerRadius Convert(CornerRadius radius, CornerRadiusFilterKind filterKind)
{
CornerRadius result = radius;

switch (filterKind)
{
case CornerRadiusFilterKind.Top:
result.BottomLeft = 0;
result.BottomRight = 0;
break;
case CornerRadiusFilterKind.Right:
result.TopLeft = 0;
result.BottomLeft = 0;
break;
case CornerRadiusFilterKind.Bottom:
result.TopLeft = 0;
result.TopRight = 0;
break;
case CornerRadiusFilterKind.Left:
result.TopRight = 0;
result.BottomRight = 0;
break;
}

return result;
}

public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
var cornerRadius = (CornerRadius)value;

var scale = Scale;
if (!double.IsNaN(scale))
{
cornerRadius.TopLeft *= scale;
cornerRadius.TopRight *= scale;
cornerRadius.BottomRight *= scale;
cornerRadius.BottomLeft *= scale;
}

var filterType = Filter;
if (filterType == CornerRadiusFilterKind.TopLeftValue ||
filterType == CornerRadiusFilterKind.BottomRightValue)
{
return GetDoubleValue(cornerRadius, filterType);
}

return Convert(cornerRadius, filterType);
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}

private static double GetDoubleValue(CornerRadius radius, CornerRadiusFilterKind filterKind)
{
switch (filterKind)
{
case CornerRadiusFilterKind.TopLeftValue:
return radius.TopLeft;
case CornerRadiusFilterKind.BottomRightValue:
return radius.BottomRight;
}
return 0;
}
}

public enum CornerRadiusFilterKind
{
None,
Top,
Right,
Bottom,
Left,
TopLeftValue,
BottomRightValue
}
32 changes: 32 additions & 0 deletions Flow.Launcher/Converters/PlacementRectangleConverter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;

namespace Flow.Launcher.Converters;

public class PlacementRectangleConverter : IMultiValueConverter
{
public Thickness Margin { get; set; }

public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
{
if (values.Length == 2 &&
values[0] is double width &&
values[1] is double height)
{
var margin = Margin;
var topLeft = new Point(margin.Left, margin.Top);
var bottomRight = new Point(width - margin.Right, height - margin.Bottom);
var rect = new Rect(topLeft, bottomRight);
return rect;
}

return Rect.Empty;
}

public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
19 changes: 19 additions & 0 deletions Flow.Launcher/Converters/SharedSizeGroupConverter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;

namespace Flow.Launcher.Converters;

public class SharedSizeGroupConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return (Visibility)value != Visibility.Collapsed ? (string)parameter : null;
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
2 changes: 1 addition & 1 deletion Flow.Launcher/Converters/StringToKeyBindingConverter.cs
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@

namespace Flow.Launcher.Converters;

class StringToKeyBindingConverter : IValueConverter
public class StringToKeyBindingConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
4 changes: 1 addition & 3 deletions Flow.Launcher/Flow.Launcher.csproj
Original file line number Diff line number Diff line change
@@ -90,6 +90,7 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="iNKORE.UI.WPF.Modern" Version="0.10.1" />
<PackageReference Include="MdXaml" Version="1.27.0" />
<PackageReference Include="MdXaml.AnimatedGif" Version="1.27.0" />
<PackageReference Include="MdXaml.Html" Version="1.27.0" />
@@ -98,9 +99,6 @@
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="9.0.7" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="9.0.7" />
<PackageReference Include="Microsoft.Toolkit.Uwp.Notifications" Version="7.1.3" />
<!-- ModernWpfUI v0.9.5 introduced WinRT changes that causes Notification platform unavailable error on some machines -->
<!-- https://github.com/Flow-Launcher/Flow.Launcher/issues/1772#issuecomment-1502440801 -->
<PackageReference Include="ModernWpfUI" Version="0.9.4" />
<PackageReference Include="PropertyChanged.Fody" Version="4.1.0">
<PrivateAssets>all</PrivateAssets>
</PackageReference>
33 changes: 33 additions & 0 deletions Flow.Launcher/Helper/BorderHelper.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using System.Windows;
using System.Windows.Controls;

namespace Flow.Launcher.Helper;

public static class BorderHelper
{
#region Child

public static readonly DependencyProperty ChildProperty =
DependencyProperty.RegisterAttached(
"Child",
typeof(UIElement),
typeof(BorderHelper),
new PropertyMetadata(default(UIElement), OnChildChanged));

public static UIElement GetChild(Border border)
{
return (UIElement)border.GetValue(ChildProperty);
}

public static void SetChild(Border border, UIElement value)
{
border.SetValue(ChildProperty, value);
}

private static void OnChildChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
((Border)d).Child = (UIElement)e.NewValue;
}

#endregion
}
2 changes: 1 addition & 1 deletion Flow.Launcher/HotkeyControlDialog.xaml
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
x:Class="Flow.Launcher.HotkeyControlDialog"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:ui="http://schemas.modernwpf.com/2019"
xmlns:ui="http://schemas.inkore.net/lib/ui/wpf/modern"
Background="{DynamicResource PopuBGColor}"
BorderBrush="{DynamicResource PopupButtonAreaBorderColor}"
BorderThickness="0 1 0 0"
2 changes: 1 addition & 1 deletion Flow.Launcher/HotkeyControlDialog.xaml.cs
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@
using Flow.Launcher.Infrastructure.Hotkey;
using Flow.Launcher.Infrastructure.UserSettings;
using Flow.Launcher.Plugin;
using ModernWpf.Controls;
using iNKORE.UI.WPF.Modern.Controls;

namespace Flow.Launcher;

@@ -31,7 +31,7 @@
Delete
}

public EResultType ResultType { get; private set; } = EResultType.Cancel;

Check warning on line 34 in Flow.Launcher/HotkeyControlDialog.xaml.cs

GitHub Actions / Check Spelling

`EResult` is not a recognized word. (unrecognized-spelling)

Check warning on line 34 in Flow.Launcher/HotkeyControlDialog.xaml.cs

GitHub Actions / Check Spelling

`EResult` is not a recognized word. (unrecognized-spelling)
public string ResultValue { get; private set; } = string.Empty;
public static string EmptyHotkey => App.API.GetTranslation("none");

@@ -75,7 +75,7 @@
ChefKeysManager.StartMenuEnableBlocking = false;
ChefKeysManager.Stop();

ResultType = EResultType.Cancel;

Check warning on line 78 in Flow.Launcher/HotkeyControlDialog.xaml.cs

GitHub Actions / Check Spelling

`EResult` is not a recognized word. (unrecognized-spelling)
Hide();
}

@@ -86,7 +86,7 @@

if (KeysToDisplay.Count == 1 && KeysToDisplay[0] == EmptyHotkey)
{
ResultType = EResultType.Delete;

Check warning on line 89 in Flow.Launcher/HotkeyControlDialog.xaml.cs

GitHub Actions / Check Spelling

`EResult` is not a recognized word. (unrecognized-spelling)
Hide();
return;
}
2 changes: 1 addition & 1 deletion Flow.Launcher/MainWindow.xaml
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:flowlauncher="clr-namespace:Flow.Launcher"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ui="http://schemas.modernwpf.com/2019"
xmlns:ui="http://schemas.inkore.net/lib/ui/wpf/modern"
xmlns:vm="clr-namespace:Flow.Launcher.ViewModel"
Name="FlowMainWindow"
Title="Flow Launcher"
7 changes: 4 additions & 3 deletions Flow.Launcher/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -25,7 +25,8 @@
using Flow.Launcher.Plugin.SharedCommands;
using Flow.Launcher.Plugin.SharedModels;
using Flow.Launcher.ViewModel;
using ModernWpf.Controls;
using iNKORE.UI.WPF.Modern;
using iNKORE.UI.WPF.Modern.Controls;
using DataObject = System.Windows.DataObject;
using Key = System.Windows.Input.Key;
using MouseButtons = System.Windows.Forms.MouseButtons;
@@ -113,7 +114,7 @@
{
var handle = Win32Helper.GetWindowHandle(this, true);
_hwndSource = HwndSource.FromHwnd(handle);
_hwndSource.AddHook(WndProc);

Check warning on line 117 in Flow.Launcher/MainWindow.xaml.cs

GitHub Actions / Check Spelling

`Wnd` is not a recognized word. (unrecognized-spelling)
Win32Helper.HideFromAltTab(this);
Win32Helper.DisableControlBox(this);
}
@@ -189,11 +190,11 @@
// Initialize color scheme
if (_settings.ColorScheme == Constant.Light)
{
ModernWpf.ThemeManager.Current.ApplicationTheme = ModernWpf.ApplicationTheme.Light;
ThemeManager.Current.ApplicationTheme = ApplicationTheme.Light;
}
else if (_settings.ColorScheme == Constant.Dark)
{
ModernWpf.ThemeManager.Current.ApplicationTheme = ModernWpf.ApplicationTheme.Dark;
ThemeManager.Current.ApplicationTheme = ApplicationTheme.Dark;
}

// Initialize position
@@ -820,7 +821,7 @@

public void UpdatePosition()
{
// Initialize call twice to work around multi-display alignment issue- https://github.com/Flow-Launcher/Flow.Launcher/issues/2910

Check failure on line 824 in Flow.Launcher/MainWindow.xaml.cs

GitHub Actions / Check Spelling

`work around` matches a line_forbidden.patterns entry: `\bwork[- ]arounds?\b`. (forbidden-pattern)
if (_viewModel.IsDialogJumpWindowUnderDialog())
{
InitializeDialogJumpPosition();
@@ -844,7 +845,7 @@

private void InitializePosition()
{
// Initialize call twice to work around multi-display alignment issue- https://github.com/Flow-Launcher/Flow.Launcher/issues/2910

Check failure on line 848 in Flow.Launcher/MainWindow.xaml.cs

GitHub Actions / Check Spelling

`work around` matches a line_forbidden.patterns entry: `\bwork[- ]arounds?\b`. (forbidden-pattern)
InitializePositionInner();
InitializePositionInner();
return;
5 changes: 3 additions & 2 deletions Flow.Launcher/PluginUpdateWindow.xaml
Original file line number Diff line number Diff line change
@@ -4,6 +4,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:flowlauncher="clr-namespace:Flow.Launcher"
xmlns:ui="http://schemas.inkore.net/lib/ui/wpf/modern"
Title="{DynamicResource updateAllPluginsButtonContent}"
Width="530"
Background="{DynamicResource PopuBGColor}"
@@ -66,13 +67,13 @@
Text="{DynamicResource updateAllPluginsButtonContent}"
TextAlignment="Left" />

<ScrollViewer
<ui:ScrollViewerEx
MaxHeight="300"
Margin="0 5 0 5"
HorizontalScrollBarVisibility="Disabled"
VerticalScrollBarVisibility="Auto">
<StackPanel x:Name="UpdatePluginStackPanel" />
</ScrollViewer>
</ui:ScrollViewerEx>

<Rectangle
Height="1"
2 changes: 1 addition & 1 deletion Flow.Launcher/PublicAPIInstance.cs
Original file line number Diff line number Diff line change
@@ -30,8 +30,8 @@
using Flow.Launcher.Plugin.SharedCommands;
using Flow.Launcher.Plugin.SharedModels;
using Flow.Launcher.ViewModel;
using iNKORE.UI.WPF.Modern;
using JetBrains.Annotations;
using ModernWpf;
using Squirrel;
using Stopwatch = Flow.Launcher.Infrastructure.Stopwatch;

6 changes: 3 additions & 3 deletions Flow.Launcher/ReleaseNotesWindow.xaml
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@
xmlns:local="clr-namespace:Flow.Launcher"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:mdxam="clr-namespace:MdXaml;assembly=MdXaml"
xmlns:ui="http://schemas.modernwpf.com/2019"
xmlns:ui="http://schemas.inkore.net/lib/ui/wpf/modern"
xmlns:vm="clr-namespace:Flow.Launcher.ViewModel"
Title="{DynamicResource releaseNotes}"
Width="940"
@@ -166,7 +166,7 @@
</Grid>

<!-- Do not use scroll function of MarkdownViewer because it does not support smooth scroll -->
<ScrollViewer
<ui:ScrollViewerEx
x:Name="MarkdownScrollViewer"
Grid.Row="2"
Grid.Column="0"
@@ -193,7 +193,7 @@
VerticalScrollBarVisibility="Disabled"
Visibility="Collapsed" />
</Grid>
</ScrollViewer>
</ui:ScrollViewerEx>

<!-- This Grid is for display progress ring and refresh button. -->
<!-- And it is also for changing the size of the MarkdownViewer. -->
9 changes: 5 additions & 4 deletions Flow.Launcher/ReleaseNotesWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -10,6 +10,7 @@
using System.Windows.Input;
using System.Windows.Media;
using Flow.Launcher.Infrastructure.Http;
using iNKORE.UI.WPF.Modern;

namespace Flow.Launcher
{
@@ -21,16 +22,16 @@ public ReleaseNotesWindow()
{
InitializeComponent();
SeeMore.Uri = ReleaseNotes;
ModernWpf.ThemeManager.Current.ActualApplicationThemeChanged += ThemeManager_ActualApplicationThemeChanged;
ThemeManager.Current.ActualApplicationThemeChanged += ThemeManager_ActualApplicationThemeChanged;
}

#region Window Events

private void ThemeManager_ActualApplicationThemeChanged(ModernWpf.ThemeManager sender, object args)
private void ThemeManager_ActualApplicationThemeChanged(ThemeManager sender, object args)
{
Application.Current.Dispatcher.Invoke(() =>
{
if (ModernWpf.ThemeManager.Current.ActualApplicationTheme == ModernWpf.ApplicationTheme.Light)
if (ThemeManager.Current.ActualApplicationTheme == ApplicationTheme.Light)
{
MarkdownViewer.MarkdownStyle = (Style)Application.Current.Resources["DocumentStyleGithubLikeLight"];
MarkdownViewer.Foreground = Brushes.Black;
@@ -58,7 +59,7 @@ private void OnCloseExecuted(object sender, ExecutedRoutedEventArgs e)

private void Window_Closed(object sender, EventArgs e)
{
ModernWpf.ThemeManager.Current.ActualApplicationThemeChanged -= ThemeManager_ActualApplicationThemeChanged;
ThemeManager.Current.ActualApplicationThemeChanged -= ThemeManager_ActualApplicationThemeChanged;
}

#endregion
Loading
Oops, something went wrong.
Loading
Oops, something went wrong.