Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"isRoot": true,
"tools": {
"uno.check": {
"version": "1.20.2",
"version": "1.27.4",
"commands": [
"uno-check"
]
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ jobs:

- name: Run SourceGenerators tests
id: test-generator
run: vstest.console.exe ./tooling/CommunityToolkit.Tooling.SampleGen.Tests/bin/Release/net6.0/CommunityToolkit.Tooling.SampleGen.Tests.dll /logger:"trx;LogFileName=SourceGenerators.trx"
run: vstest.console.exe ./tooling/CommunityToolkit.Tooling.SampleGen.Tests/bin/Release/net8.0/CommunityToolkit.Tooling.SampleGen.Tests.dll /logger:"trx;LogFileName=SourceGenerators.trx"

- name: Run component tests against ${{ matrix.multitarget }}
if: ${{ matrix.multitarget == 'uwp' || matrix.multitarget == 'wasdk' }}
Expand Down
5 changes: 4 additions & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,11 @@
<NoWarn>$(NoWarn);TKSMPL0014;</NoWarn>

<!-- See https://github.com/CommunityToolkit/Windows/pull/567#issuecomment-2498739244 -->
<WarningsNotAsErrors>NU1901;NU1902;NU1903;NU1904</WarningsNotAsErrors>
<WarningsNotAsErrors>$(WarningsNotAsErrors);NU1901;NU1902;NU1903;NU1904</WarningsNotAsErrors>
<NoWarn>$(NoWarn);TKSMPL0014;</NoWarn>

<!-- See https://github.com/CommunityToolkit/Windows/pull/609#issuecomment-2613505591 -->
<WarningsNotAsErrors>$(WarningsNotAsErrors);CS0419;CS1570;CS1574</WarningsNotAsErrors>
</PropertyGroup>

<Import Project="Windows.Toolkit.Common.props" />
Expand Down
3 changes: 3 additions & 0 deletions components/Behaviors/src/Headers/FadeHeaderBehavior.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ protected override bool AssignAnimation()
return false;
}

/// <summary>
/// Stops the animation.
/// </summary>
protected override void StopAnimation()
{
if (_headerVisual != null)
Expand Down
15 changes: 15 additions & 0 deletions components/Behaviors/src/Headers/HeaderBehaviorBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,24 @@ public abstract class HeaderBehaviorBase : BehaviorBase<FrameworkElement>
// From Doc: https://learn.microsoft.com/windows/windows-app-sdk/api/winrt/microsoft.ui.xaml.controls.canvas.zindex
private const int CanvasZIndexMax = 1_000_000;

/// <summary>
/// The ScrollViewer associated with the ListViewBase control.
/// </summary>
protected ScrollViewer? _scrollViewer;

/// <summary>
/// The CompositionPropertySet associated with the ScrollViewer.
/// </summary>
protected CompositionPropertySet? _scrollProperties;

/// <summary>
/// The CompositionPropertySet associated with the animation.
/// </summary>
protected CompositionPropertySet? _animationProperties;

/// <summary>
/// The Visual associated with the header element.
/// </summary>
protected Visual? _headerVisual;

/// <summary>
Expand Down
11 changes: 9 additions & 2 deletions components/ImageCropper/src/ImageCropperThumb.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public ImageCropperThumb()

}

/// <inheritdoc/>
protected override void OnApplyTemplate()
{
PointerEntered -= Control_PointerEntered;
Expand Down Expand Up @@ -79,8 +80,6 @@ private static void OnXChanged(DependencyObject d, DependencyPropertyChangedEven
target.UpdatePosition();
}



private static void OnYChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var target = (ImageCropperThumb)d;
Expand All @@ -99,12 +98,18 @@ private static void OnYChanged(DependencyObject d, DependencyPropertyChangedEven
public static readonly DependencyProperty YProperty =
DependencyProperty.Register(nameof(Y), typeof(double), typeof(ImageCropperThumb), new PropertyMetadata(0d, OnYChanged));

/// <summary>
/// Handles the PointerEntered event.
/// </summary>
public void Control_PointerEntered(object sender, PointerRoutedEventArgs e)
{
base.OnPointerEntered(e);
VisualStateManager.GoToState(this, PointerOverState, true);
}

/// <summary>
/// Handles the PointerExited event.
/// </summary>
public void Control_PointerExited(object sender, PointerRoutedEventArgs e)
{
base.OnPointerExited(e);
Expand All @@ -123,12 +128,14 @@ private void Control_PointerCanceled(object sender, PointerRoutedEventArgs e)
VisualStateManager.GoToState(this, NormalState, true);
}

/// <inheritdoc/>
protected override void OnPointerPressed(PointerRoutedEventArgs e)
{
base.OnPointerPressed(e);
VisualStateManager.GoToState(this, PressedState, true);
}

/// <inheritdoc/>
protected override void OnPointerReleased(PointerRoutedEventArgs e)
{
base.OnPointerReleased(e);
Expand Down
1 change: 1 addition & 0 deletions components/Media/src/Helpers/SurfaceLoader.Instance.cs
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ public async Task<CompositionDrawingSurface> LoadFromUri(Uri uri, Size sizeTarge
return await LoadFromUri(uri, sizeTarget);
}

/// <inheritdoc/>
public void Dispose()
{
compositionDevice?.Dispose();
Expand Down
2 changes: 2 additions & 0 deletions components/Primitives/src/SwitchPresenter/SwitchConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,15 @@ public SwitchConverter()
SwitchCases = new CaseCollection();
}

/// <inheritdoc/>
public object Convert(object value, Type targetType, object parameter, string language)
{
var result = SwitchCases.EvaluateCases(value, TargetType ?? targetType);

return result?.Content!;
}

/// <inheritdoc/>
public object ConvertBack(object value, Type targetType, object parameter, string language)
{
throw new NotImplementedException();
Expand Down
1 change: 1 addition & 0 deletions components/Primitives/src/SwitchPresenter/SwitchHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ internal static partial class SwitchHelpers
/// </summary>
/// <param name="compare">Our main value in our SwitchPresenter.</param>
/// <param name="value">The value from the case to compare to.</param>
/// <param name="targetType">The desired type of the result for automatic conversion.</param>
/// <returns>true if the two values are equal</returns>
internal static bool CompareValues(object compare, object value, Type targetType)
{
Expand Down
12 changes: 12 additions & 0 deletions components/Segmented/src/EqualPanel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,18 @@

namespace CommunityToolkit.WinUI.Controls;

/// <summary>
/// A panel that arranges its children in equal columns.
/// </summary>
public partial class EqualPanel : Panel
{
private double _maxItemWidth = 0;
private double _maxItemHeight = 0;
private int _visibleItemsCount = 0;

/// <summary>
/// Gets or sets the spacing between items.
/// </summary>
public double Spacing
{
get { return (double)GetValue(SpacingProperty); }
Expand All @@ -27,11 +34,15 @@ public double Spacing
typeof(EqualPanel),
new PropertyMetadata(default(double), OnSpacingChanged));

/// <summary>
/// Creates a new instance of the <see cref="EqualPanel"/> class.
/// </summary>
public EqualPanel()
{
RegisterPropertyChangedCallback(HorizontalAlignmentProperty, OnHorizontalAlignmentChanged);
}

/// <inheritdoc/>
protected override Size MeasureOverride(Size availableSize)
{
_maxItemWidth = 0;
Expand Down Expand Up @@ -69,6 +80,7 @@ protected override Size MeasureOverride(Size availableSize)
}
}

/// <inheritdoc/>
protected override Size ArrangeOverride(Size finalSize)
{
double x = 0;
Expand Down
5 changes: 5 additions & 0 deletions components/Segmented/src/Helpers/SegmentedMarginConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

namespace CommunityToolkit.WinUI.Controls;

/// <summary>
/// A converter that returns a margin based on the position of the item in a segmented control.
/// </summary>
public partial class SegmentedMarginConverter : DependencyObject, IValueConverter
{
/// <summary>
Expand Down Expand Up @@ -51,6 +54,7 @@ public Thickness RightItemMargin
set { SetValue(RightItemMarginProperty, value); }
}

/// <inheritdoc/>
public object Convert(object value, Type targetType, object parameter, string language)
{
var segmentedItem = value as SegmentedItem;
Expand All @@ -72,6 +76,7 @@ public object Convert(object value, Type targetType, object parameter, string la
}
}

/// <inheritdoc/>
public object ConvertBack(object value, Type targetType, object parameter, string language)
{
return value;
Expand Down
11 changes: 11 additions & 0 deletions components/Segmented/src/Segmented/Segmented.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,34 @@

namespace CommunityToolkit.WinUI.Controls;

/// <summary>
/// A control that displays a set of items that can be selected by the user.
/// </summary>
public partial class Segmented : ListViewBase
{
private int _internalSelectedIndex = -1;
private bool _hasLoaded = false;

/// <summary>
/// Creates a new instance of <see cref="Segmented"/>.
/// </summary>
public Segmented()
{
this.DefaultStyleKey = typeof(Segmented);

RegisterPropertyChangedCallback(SelectedIndexProperty, OnSelectedIndexChanged);
}

/// <inheritdoc/>
protected override DependencyObject GetContainerForItemOverride() => new SegmentedItem();

/// <inheritdoc/>
protected override bool IsItemItsOwnContainerOverride(object item)
{
return item is SegmentedItem;
}

/// <inheritdoc/>
protected override void OnApplyTemplate()
{
base.OnApplyTemplate();
Expand All @@ -37,6 +46,7 @@ protected override void OnApplyTemplate()
PreviewKeyDown += Segmented_PreviewKeyDown;
}

/// <inheritdoc/>
protected override void PrepareContainerForItemOverride(DependencyObject element, object item)
{
base.PrepareContainerForItemOverride(element, item);
Expand All @@ -63,6 +73,7 @@ private void SegmentedItem_Loaded(object sender, RoutedEventArgs e)
}
}

/// <inheritdoc/>
protected override void OnItemsChanged(object e)
{
base.OnItemsChanged(e);
Expand Down
13 changes: 13 additions & 0 deletions components/Segmented/src/SegmentedItem/SegmentedItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,35 @@

namespace CommunityToolkit.WinUI.Controls;

/// <summary>
/// Represents an item in a <see cref="Segmented"/> control.
/// </summary>
[ContentProperty(Name = nameof(Content))]
public partial class SegmentedItem : ListViewItem
{
internal const string IconLeftState = "IconLeft";
internal const string IconOnlyState = "IconOnly";
internal const string ContentOnlyState = "ContentOnly";

/// <summary>
/// Creates a new instance of <see cref="SegmentedItem"/>.
/// </summary>
public SegmentedItem()
{
this.DefaultStyleKey = typeof(SegmentedItem);
}

/// <inheritdoc/>
protected override void OnApplyTemplate()
{
base.OnApplyTemplate();
OnIconChanged();
ContentChanged();
}

/// <summary>
/// Handles changes to the Content property.
/// </summary>
protected override void OnContentChanged(object oldContent, object newContent)
{
base.OnContentChanged(oldContent, newContent);
Expand All @@ -41,6 +51,9 @@ private void ContentChanged()
}
}

/// <summary>
/// Handles changes to the Icon property.
/// </summary>
protected virtual void OnIconPropertyChanged(IconElement oldValue, IconElement newValue)
{
OnIconChanged();
Expand Down
16 changes: 15 additions & 1 deletion components/SettingsControls/src/Helpers/StyleExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,38 @@

namespace CommunityToolkit.WinUI.Controls;

// Adapted from https://github.com/rudyhuyn/XamlPlus
/// <summary>
/// Helper class for setting a ResourceDictionary on a Style.
/// </summary>
/// <remarks>
/// Adapted from https://github.com/rudyhuyn/XamlPlus
/// </remarks>
public static partial class StyleExtensions
{
// Used to distinct normal ResourceDictionary and the one we add.
private sealed partial class StyleExtensionResourceDictionary : ResourceDictionary
{
}

/// <summary>
/// Get a ResourceDictionary from a Style.
/// </summary>
public static ResourceDictionary GetResources(Style obj)
{
return (ResourceDictionary)obj.GetValue(ResourcesProperty);
}

/// <summary>
/// Set the <see cref="ResourcesProperty"/> on a Style to a ResourceDictionary value.
/// </summary>
public static void SetResources(Style obj, ResourceDictionary value)
{
obj.SetValue(ResourcesProperty, value);
}

/// <summary>
/// Attached property to set a Style to a ResourceDictionary value.
/// </summary>
public static readonly DependencyProperty ResourcesProperty =
DependencyProperty.RegisterAttached("Resources", typeof(ResourceDictionary), typeof(StyleExtensions), new PropertyMetadata(null, ResourcesChanged));

Expand Down
Loading
Loading