-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
[Peek] Add customized title bar #22600
Changes from all commits
74bb74f
e930ed3
39b65fc
a6b8fa5
f51102f
173b9bf
a170c38
9c3dade
da818d7
ec4ed37
5b3dee3
d75589c
9dfc94d
2cfc842
c6972c0
85b0f4c
81979fb
6068983
304db06
49bc4fa
05a2bfe
cce2a4e
ceb21ac
ca93d17
9e9ce24
57871a9
1df7f09
6dc21c8
52bdd77
2ebe212
34fc67d
8162a8c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// Copyright (c) Microsoft Corporation | ||
// The Microsoft Corporation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using System.Diagnostics; | ||
using System.Runtime.InteropServices; | ||
using System.Text; | ||
using Peek.Common.Models; | ||
using Peek.UI.Native; | ||
|
||
namespace Peek.UI.Helpers | ||
{ | ||
public static class DefaultAppHelper | ||
{ | ||
public static string TryGetDefaultAppName(string extension) | ||
{ | ||
string appName = string.Empty; | ||
|
||
// Get the length of the app name | ||
uint length = 0; | ||
HResult ret = NativeMethods.AssocQueryString(NativeMethods.AssocF.Verify, NativeMethods.AssocStr.FriendlyAppName, extension, null, null, ref length); | ||
if (ret != HResult.False) | ||
{ | ||
Debug.WriteLine($"Error when getting accessString for {extension} file: {Marshal.GetExceptionForHR((int)ret)!.Message}"); | ||
return appName; | ||
} | ||
|
||
// Get the the app name | ||
StringBuilder sb = new ((int)length); | ||
ret = NativeMethods.AssocQueryString(NativeMethods.AssocF.Verify, NativeMethods.AssocStr.FriendlyAppName, extension, null, sb, ref length); | ||
if (ret != HResult.Ok) | ||
{ | ||
Debug.WriteLine($"Error when getting accessString for {extension} file: {Marshal.GetExceptionForHR((int)ret)!.Message}" ); | ||
return appName; | ||
} | ||
|
||
appName = sb.ToString(); | ||
return appName; | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,11 +17,15 @@ | |
|
||
<Grid> | ||
<Grid.RowDefinitions> | ||
<RowDefinition Height="32" /> | ||
<RowDefinition Height="48" /> | ||
<RowDefinition Height="*" /> | ||
</Grid.RowDefinitions> | ||
|
||
<views:TitleBar x:Name="TitleBarControl" Grid.Row="0" /> | ||
<views:TitleBar | ||
x:Name="TitleBarControl" | ||
Grid.Row="0" | ||
File="{x:Bind ViewModel.CurrentFile, Mode=OneWay}" | ||
NumberOfFiles="{x:Bind ViewModel.Files.Count, Mode=OneWay}" /> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry! My navigation/file query work that was merged in will probably conflict with this. You'll have to pull the Count from FolderItemsQuery.Files. Though I can see some issues, since we're now updating Files and CurrentItemIndex from a background thread so we might have some wrong thread exceptions if we make the properties observable. If it's too much work, it might be worth doing this dynamic count updating in a separate PR. Binding to CurrentFile from that new FolderItemsQuery shouldn't be a problem though There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No worries, we can always update after your PR gets merged. |
||
|
||
<fp:FilePreview | ||
Grid.Row="1" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this breaking the edge-to-edge display? TitleBarHeight is used for window centering/resizing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope :) coz you used "ActualHeight" for calculating the max sizes, etc. I think. It is just gonna have a bit of a wider topbar: