-
Notifications
You must be signed in to change notification settings - Fork 6.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[AdvancedPaste] Improved paste window menu layout
- Loading branch information
1 parent
35e6375
commit a25fbe3
Showing
4 changed files
with
39 additions
and
7 deletions.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
...AdvancedPaste/AdvancedPaste/AdvancedPasteXAML/Converters/PasteFormatsToHeightConverter.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// 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; | ||
using System.Collections; | ||
using Microsoft.UI.Xaml; | ||
using Microsoft.UI.Xaml.Data; | ||
|
||
namespace AdvancedPaste.Converters; | ||
|
||
public sealed partial class PasteFormatsToHeightConverter : IValueConverter | ||
{ | ||
private const int ItemHeight = 40; | ||
|
||
public int MaxItems { get; set; } = 5; | ||
|
||
public object Convert(object value, Type targetType, object parameter, string language) => | ||
new GridLength(Convert((value is ICollection collection) ? collection.Count : (value is int intValue) ? intValue : 0)); | ||
|
||
public int Convert(int itemCount) => Math.Min(MaxItems, itemCount) * ItemHeight; | ||
|
||
public object ConvertBack(object value, Type targetType, object parameter, string language) => throw new NotImplementedException(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters