Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit 1d23724
Author: Marcel Wagner <marcel.alex.wagner@outlook.com>
Date:   Wed Oct 11 02:31:01 2023 +0200

    Cleanup unnecessary code (microsoft#1299)

commit 20cd457
Author: Scott Jones <scottj1s@gmail.com>
Date:   Tue Oct 10 17:30:05 2023 -0700

    Update to WinAppSDK 1.4.2 and remove temporary workaround for including version info without dupe warnings (microsoft#1379)

commit c2fd30d
Author: Scott Jones <scottj1s@gmail.com>
Date:   Tue Oct 10 10:47:39 2023 -0700

    Set TrimMode explicitly back to partial for .NET 7 compat (microsoft#1378)

    See:

    https://learn.microsoft.com/en-us/dotnet/core/deploying/trimming/trimming-options?pivots=dotnet-7-0

commit f72609f
Author: Pratik Anand <pratik.preet@gmail.com>
Date:   Tue Oct 3 12:29:10 2023 -0700

    Clickable Interactive control sample for custom titlebar (microsoft#1360)

    With 1.4 changes, WinUI 3 custom titlebar now uses appwindow titlebar + nonclientinputpointersource apis under the hood. This opens up new possibilities like allowing clickable interactive controls like textbox, button in the titlebar area, surrounded by draggable region on both left and the right sides.

    This code adds a sample to titlebar page which shows users how to create interactive controls in winui 3 titlebar. It also demonstrates the power of mixing and matching high level winui 3 custom titlebar apis and low level nonclient apis.

commit 5a96afc
Author: Andrew KeepCoding <andrewkeepcoding@gmail.com>
Date:   Thu Sep 28 19:31:59 2023 +0900

    Fix issue that crashes the app when navigating to SemanticZoomPage (microsoft#1363)

commit 9650e4e
Author: Marcel Wagner <marcel.alex.wagner@outlook.com>
Date:   Thu Sep 28 12:31:39 2023 +0200

    Switch .NET 7 (microsoft#1115)

commit 8f1b425
Author: Marcel Wagner <marcel.alex.wagner@outlook.com>
Date:   Thu Sep 28 12:31:22 2023 +0200

    First round of UWP link replacement (microsoft#1347)

    Co-authored-by: Bob Pulliam <bpulliam@microsoft.com>
  • Loading branch information
marcelwgn committed Oct 11, 2023
1 parent 5a1a2cc commit 4713920
Show file tree
Hide file tree
Showing 52 changed files with 443 additions and 680 deletions.
5 changes: 0 additions & 5 deletions WinUIGallery/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,6 @@ protected override void OnLaunched(Microsoft.UI.Xaml.LaunchActivatedEventArgs ar
startupWindow = WindowHelper.CreateWindow();
startupWindow.ExtendsContentIntoTitleBar = true;
#if DEBUG
//if (System.Diagnostics.Debugger.IsAttached)
//{
// this.DebugSettings.EnableFrameRateCounter = true;
//}

if (System.Diagnostics.Debugger.IsAttached)
{
this.DebugSettings.BindingFailed += DebugSettings_BindingFailed;
Expand Down
6 changes: 2 additions & 4 deletions WinUIGallery/Common/ActivityFeedLayout.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using Windows.Foundation;
using Microsoft.UI.Xaml;
Expand Down Expand Up @@ -95,8 +95,7 @@ private static void OnPropertyChanged(DependencyObject obj, DependencyPropertyCh
protected override void InitializeForContextCore(VirtualizingLayoutContext context)
{
base.InitializeForContextCore(context);

if (!(context.LayoutState is ActivityFeedLayoutState state))
if (!(context.LayoutState is ActivityFeedLayoutState))
{
// Store any state we might need since (in theory) the layout could be in use by multiple
// elements simultaneously
Expand Down Expand Up @@ -169,7 +168,6 @@ protected override Size MeasureOverride(VirtualizingLayoutContext context, Size
for (int columnIndex = 0; columnIndex < 3; columnIndex++)
{
var index = firstItemIndex + columnIndex;
var rect = boundsForCurrentRow[index % 3];
var container = context.GetOrCreateElementAt(index);

container.Measure(
Expand Down
3 changes: 1 addition & 2 deletions WinUIGallery/Common/Category.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using Microsoft.UI.Xaml.Controls;

namespace AppUIBasics.Common
Expand All @@ -11,7 +11,6 @@ public class Category : CategoryBase
public string Name { get; set; }
public string Tooltip { get; set; }
public Symbol Glyph { get; set; }
//public Type TargetType { get; set; }
}

public class Separator : CategoryBase { }
Expand Down
7 changes: 1 addition & 6 deletions WinUIGallery/Common/ColorSlideTransitionHelper.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//*********************************************************
//*********************************************************
//
// Copyright (c) Microsoft. All rights reserved.
// This code is licensed under the MIT License (MIT).
Expand All @@ -25,7 +25,6 @@ public class ColorSlideTransitionHelper
{
#region Member variables

UIElement hostForVisual;
Compositor _compositor;
ContainerVisual _containerForVisuals;
ScalarKeyFrameAnimation _slideAnimation;
Expand All @@ -42,10 +41,6 @@ public class ColorSlideTransitionHelper
/// </summary>
public ColorSlideTransitionHelper(UIElement hostForVisual)
{


this.hostForVisual = hostForVisual;

// we have an element in the XAML tree that will host our Visuals
var visual = ElementCompositionPreview.GetElementVisual(hostForVisual);
_compositor = visual.Compositor;
Expand Down
4 changes: 1 addition & 3 deletions WinUIGallery/Common/MenuItemTemplateSelector.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Markup;
using System;
Expand All @@ -11,8 +11,6 @@ class MenuItemTemplateSelector : DataTemplateSelector
{
public DataTemplate ItemTemplate { get; set; }

//public string PaneTitle { get; set; }

protected override DataTemplate SelectTemplateCore(object item)
{
return item is Separator ? SeparatorTemplate : item is Header ? HeaderTemplate : ItemTemplate;
Expand Down
1 change: 0 additions & 1 deletion WinUIGallery/Common/Win32.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ internal static class Win32

public const int WM_ACTIVATE = 0x0006;
public const int WA_ACTIVE = 0x01;
//static int WA_CLICKACTIVE = 0x02;
public const int WA_INACTIVE = 0x00;

public const int WM_SETICON = 0x0080;
Expand Down
4 changes: 1 addition & 3 deletions WinUIGallery/Common/WrapPanel.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
Expand Down Expand Up @@ -38,7 +38,6 @@ public class WrapPanel : Panel
/// within a <see cref="T:WinRTXamlToolkit.Controls.WrapPanel" />. The
/// default value is <see cref="F:System.Double.NaN" />.
/// </value>
//[TypeConverter(typeof(LengthConverter))]
public double ItemHeight
{
get { return (double)GetValue(ItemHeightProperty); }
Expand Down Expand Up @@ -73,7 +72,6 @@ public double ItemHeight
/// contained in a <see cref="T:WinRTXamlToolkit.Controls.WrapPanel" />.
/// The default value is <see cref="F:System.Double.NaN" />.
/// </value>
//[TypeConverter(typeof(LengthConverter))]
public double ItemWidth
{
get { return (double)GetValue(ItemWidthProperty); }
Expand Down
5 changes: 2 additions & 3 deletions WinUIGallery/ConnectedAnimationPages/CollectionPage.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Media.Animation;
Expand Down Expand Up @@ -59,8 +59,7 @@ private void collection_ItemClick(object sender, ItemClickEventArgs e)
// Prepare the connected animation.
// Notice that the stored item is passed in, as well as the name of the connected element.
// The animation will actually start on the Detailed info page.
var animation = collection.PrepareConnectedAnimation("ForwardConnectedAnimation", _storeditem, "connectedElement");

collection.PrepareConnectedAnimation("ForwardConnectedAnimation", _storeditem, "connectedElement");
}

// Navigate to the DetailedInfoPage.
Expand Down
1 change: 1 addition & 0 deletions WinUIGallery/ContentIncludes.props
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,7 @@
<Content Include="ControlPagesSampleCode\Window\CreateWindowSample1.txt" />
<Content Include="ControlPagesSampleCode\Window\TitleBar\TitleBarSample1.txt" />
<Content Include="ControlPagesSampleCode\Window\TitleBar\TitleBarSample2.txt" />
<Content Include="ControlPagesSampleCode\Window\TitleBar\TitleBarSample3.txt" />
<Content Include="Common\ReadMe.txt" />
<Content Include="DataModel\ControlInfoData.json" />
</ItemGroup>
Expand Down
11 changes: 0 additions & 11 deletions WinUIGallery/ControlPages/AppBarSeparatorPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,5 @@ public AppBarSeparatorPage()
{
this.InitializeComponent();
}
private void CompactButton_Click(object sender, RoutedEventArgs e)
{
if ((sender as AppBarToggleButton).IsChecked == true)
{
Control1.DefaultLabelPosition = CommandBarDefaultLabelPosition.Collapsed;
}
else
{
Control1.DefaultLabelPosition = CommandBarDefaultLabelPosition.Bottom;
}
}
}
}
11 changes: 0 additions & 11 deletions WinUIGallery/ControlPages/AppBarToggleButtonPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,6 @@ public AppBarToggleButtonPage()
this.InitializeComponent();
}

private void CompactButton_Click(object sender, RoutedEventArgs e)
{
if (sender is ToggleButton toggle && toggle.IsChecked != null)
{
Button1.IsCompact =
Button2.IsCompact =
Button3.IsCompact =
Button4.IsCompact = (bool)toggle.IsChecked;
}
}

private void AppBarButton_Click(object sender, RoutedEventArgs e)
{
if (sender is AppBarToggleButton b)
Expand Down
2 changes: 1 addition & 1 deletion WinUIGallery/ControlPages/ComboBoxPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ private void Combo3_TextSubmitted(ComboBox sender, ComboBoxTextSubmittedEventArg
dialog.CloseButtonText = "Close";
dialog.DefaultButton = ContentDialogButton.Close;
dialog.XamlRoot = sender.XamlRoot;
var task = dialog.ShowAsync();
_ = dialog.ShowAsync();
}

// Mark the event as handled so the framework doesn’t update the selected item automatically.
Expand Down
1 change: 0 additions & 1 deletion WinUIGallery/ControlPages/CommandBarPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ private void CloseButton_Click(object sender, RoutedEventArgs e)

private void OnElementClicked(object sender, Microsoft.UI.Xaml.RoutedEventArgs e)
{
var selectedFlyoutItem = sender as AppBarButton;
SelectedOptionText.Text = "You clicked: " + (sender as AppBarButton).Label;
}

Expand Down
7 changes: 1 addition & 6 deletions WinUIGallery/ControlPages/CreateMultipleWindowsPage.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//*********************************************************
//*********************************************************
//
// Copyright (c) Microsoft. All rights reserved.
// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
Expand All @@ -23,11 +23,6 @@ public CreateMultipleWindowsPage()
this.InitializeComponent();
}

private void List_GotFocus(object sender, RoutedEventArgs e)
{
Control1.StartBringIntoView();
}

private void createNewWindow_Click(object sender, RoutedEventArgs e)
{
var newWindow = WindowHelper.CreateWindow();
Expand Down
3 changes: 2 additions & 1 deletion WinUIGallery/ControlPages/DesignGuidance/IconsPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,8 @@
<Paragraph>
If you don't specify a FontFamily,
or you specify a FontFamily that is not available on the system at runtime,
the <Hyperlink NavigateUri="https://learn.microsoft.com/uwp/api/windows.ui.xaml.controls.fonticon">FontIcon</Hyperlink> falls back to the default font family defined by the SymbolThemeFontFamily resource.</Paragraph>
the <Hyperlink NavigateUri="https://learn.microsoft.com/windows/windows-app-sdk/api/winrt/microsoft.ui.xaml.controls.fonticon">FontIcon</Hyperlink> falls back to the default font family defined by the SymbolThemeFontFamily resource.
</Paragraph>
<Paragraph>
An icon with a 16-epx font size is the equivalent of a 16x16-epx icon, to make sizing and positioning more predictable.
For optimal appearance, use these specific sizes: 16, 20, 24, 32, 40, 48, and 64. Deviating from these font sizes could lead to less crisp or blurry outcomes.
Expand Down
1 change: 0 additions & 1 deletion WinUIGallery/ControlPages/ItemsRepeaterPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,6 @@ private void InitializeData()
Click="OnAnimatedItemClicked"
GotFocus="OnAnimatedItemGotFocus"
HorizontalAlignment="Stretch"
Loaded="GetButtonSize"
Foreground="{ThemeResource TextFillColorInverseBrush}">
</Button>
</DataTemplate>
Expand Down
30 changes: 0 additions & 30 deletions WinUIGallery/ControlPages/ItemsRepeaterPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ public sealed partial class ItemsRepeaterPage : ItemsPageBase
public List<Recipe> staticRecipeData;
private bool IsSortDescending = false;

private double AnimatedBtnHeight;
private Thickness AnimatedBtnMargin;
private Button LastSelectedColorButton;
private int PreviouslyFocusedAnimatedScrollRepeaterIndex = -1;

Expand Down Expand Up @@ -316,13 +314,6 @@ private void OnElementPrepared(Microsoft.UI.Xaml.Controls.ItemsRepeater sender,
item.StartAnimation("CenterPoint", centerPointExpression);
}

private void GetButtonSize(object sender, RoutedEventArgs e)
{
Button AnimatedBtn = sender as Button;
AnimatedBtnHeight = AnimatedBtn.ActualHeight;
AnimatedBtnMargin = AnimatedBtn.Margin;
}

private void SetUIANamesForSelectedEntry(Button selectedItem)
{
if (LastSelectedColorButton != null && LastSelectedColorButton.Content is string content)
Expand All @@ -334,27 +325,6 @@ private void SetUIANamesForSelectedEntry(Button selectedItem)
LastSelectedColorButton = selectedItem;
}

// Find centerpoint of ScrollViewer
private double CenterPointOfViewportInExtent()
{
return Animated_ScrollViewer.VerticalOffset + Animated_ScrollViewer.ViewportHeight / 2;
}

// Find index of the item that's at the center of the viewport
private int GetSelectedIndexFromViewport()
{
int selectedItemIndex = (int)Math.Floor(CenterPointOfViewportInExtent() / ((double)AnimatedBtnMargin.Top + AnimatedBtnHeight));
selectedItemIndex %= animatedScrollRepeater.ItemsSourceView.Count;
return selectedItemIndex;
}

// Return item that's currently in center of viewport
private object GetSelectedItemFromViewport()
{
var selectedIndex = GetSelectedIndexFromViewport();
var selectedElement = animatedScrollRepeater.TryGetElement(selectedIndex) as Button;
return selectedElement;
}

// ==========================================================================
// VariedImageSize Layout with Filtering/Sorting
Expand Down
31 changes: 0 additions & 31 deletions WinUIGallery/ControlPages/NavigationViewPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -198,37 +198,6 @@ private void NavigationView_SelectionChanged9(Microsoft.UI.Xaml.Controls.Navigat
contentFrame9.Navigate(pageType, null, args.RecommendedNavigationTransitionInfo);
}

private void databindHeader_Checked(object sender, RoutedEventArgs e)
{
Categories = new ObservableCollection<CategoryBase>()
{
new Header { Name = "Header1 "},
new Category { Name = "Category 1", Glyph = Symbol.Home, Tooltip = "This is category 1" },
new Category { Name = "Category 2", Glyph = Symbol.Keyboard, Tooltip = "This is category 2" },
new Separator(),
new Header { Name = "Header2 "},
new Category {Name = "Category 3", Glyph = Symbol.Library, Tooltip = "This is category 3" },
new Category {Name = "Category 4", Glyph = Symbol.Mail, Tooltip = "This is category 3" }
};
}

private void databindHeader_Checked_Unchecked(object sender, RoutedEventArgs e)
{
Categories = new ObservableCollection<CategoryBase>()
{
new Category { Name = "Category 1", Glyph = Symbol.Home, Tooltip = "This is category 1" },
new Category { Name = "Category 2", Glyph = Symbol.Keyboard, Tooltip = "This is category 2" },
new Category {Name = "Category 3", Glyph = Symbol.Library, Tooltip = "This is category 3" },
new Category {Name = "Category 4", Glyph = Symbol.Mail, Tooltip = "This is category 3" }
};
}

private void Grid_ManipulationDelta1(object sender, Microsoft.UI.Xaml.Input.ManipulationDeltaRoutedEventArgs e)
{
var grid = sender as Grid;
grid.Width = grid.ActualWidth + e.Delta.Translation.X;
}

private void headerCheck_Click(object sender, RoutedEventArgs e)
{
nvSample.AlwaysShowHeader = (sender as CheckBox).IsChecked == true ? true : false;
Expand Down
3 changes: 1 addition & 2 deletions WinUIGallery/ControlPages/PullToRefreshPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ public PullToRefreshPage()
private void PullToRefreshPage_Loaded(object sender, RoutedEventArgs e)
{
visualizerContentVisual = ElementCompositionPreview.GetElementVisual(rv2.Content);

this.Loaded -= PullToRefreshPage_Loaded;
}

Expand Down Expand Up @@ -200,7 +199,7 @@ private void rc2_RefreshRequested(RefreshContainer sender, RefreshRequestedEvent

private void rv2_RefreshStateChanged(RefreshVisualizer sender, RefreshStateChangedEventArgs args)
{
//visualizerContentVisual.StopAnimation("RotationAngle");
visualizerContentVisual.StopAnimation("RotationAngle");
}
}
}
16 changes: 2 additions & 14 deletions WinUIGallery/ControlPages/RichEditBoxPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ private void FindBoxRemoveHighlights()

private void Editor_GotFocus(object sender, RoutedEventArgs e)
{
editor.Document.GetText(TextGetOptions.UseCrlf, out string currentRawText);
editor.Document.GetText(TextGetOptions.UseCrlf, out _);

// reset colors to correct defaults for Focused state
ITextRange documentRange = editor.Document.GetRange(0, TextConstants.MaxUnitCount);
Expand All @@ -200,18 +200,6 @@ private void Editor_GotFocus(object sender, RoutedEventArgs e)
}
}

private void Page_SizeChanged(object sender, SizeChangedEventArgs e)
{
if (e.NewSize.Width <= 768)
{
editor.Width = e.NewSize.Width - 20;
}
else
{
editor.Width = e.NewSize.Width - 100;
}
}

private void REBCustom_Loaded(object sender, RoutedEventArgs e)
{
// Prior to UniversalApiContract 7, RichEditBox did not have a default ContextFlyout set.
Expand Down Expand Up @@ -243,4 +231,4 @@ private void Editor_TextChanged(object sender, RoutedEventArgs e)
}
}
}
}
}

0 comments on commit 4713920

Please sign in to comment.