Merge branch 'master' into lazyLoadingThreshold
This commit is contained in:
Коммит
21c4fb585a
|
@ -11,13 +11,18 @@ assignees: ''
|
|||
|
||||
## Describe the problem this feature would solve
|
||||
<!-- Please describe or link to any existing issues or discussions.
|
||||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] -->
|
||||
A clear and concise description of what the problem is, starting with the user story.
|
||||
Provide examples of the restrictions in the current environment that hinders the work your users or you want to perform. What are the ways this new feature will help transform and deliver those results?
|
||||
For example, I am currently using the InfiniteCanvas control which lacks the ribbon control feature. I am looking to improve user experience therefore i would like to use that in my project to provide ease of accessibility and a user-friendly interface. This new feature will provide quick access to the toolbar, enhance space utilization, etc [...] -->
|
||||
|
||||
|
||||
## Describe the solution
|
||||
<!-- A clear and concise description of what you want to happen. -->
|
||||
<!-- A clear and concise description of what you want to happen. Define how do you think it will help the community and adds value to the toolkit? -->
|
||||
|
||||
|
||||
## Describe alternatives you've considered
|
||||
<!-- A clear and concise description of any alternative solutions or features you've considered. -->
|
||||
|
||||
|
||||
## Additional context & Screenshots
|
||||
<!-- Add any other context or screenshots about the feature request here.-->
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
<!-- 🚨 Please Do Not skip any instructions and information mentioned below as they are all required and essential to evaluate and test the PR. By fulfilling all the required information you will be able to reduce the volume of questions and most likely help merge the PR faster 🚨 -->
|
||||
|
||||
<!-- 📝 It is preferred if you keep the "☑️ Allow edits by maintainers" checked in the Pull Request Template as it increases collaboration with the Toolkit maintainers by permitting commits to your PR branch (only) created from your fork. This can let us quickly make fixes for minor typos or forgotten StyleCop issues during review without needing to wait on you doing extra work. Let us help you help us! 🎉 -->
|
||||
|
||||
|
||||
## Fixes #
|
||||
<!-- Add the relevant issue number after the "#" mentioned above (for ex: Fixes #1234) which will automatically close the issue once the PR is merged. -->
|
||||
|
||||
|
@ -35,6 +38,7 @@ Please check if your PR fulfills the following requirements:
|
|||
- [ ] Pull Request has been submitted to the documentation repository [instructions](..\contributing.md#docs). Link: <!-- docs PR link -->
|
||||
- [ ] Sample in sample app has been added / updated (for bug fixes / features)
|
||||
- [ ] Icon has been created (if new sample) following the [Thumbnail Style Guide and templates](https://github.com/windows-toolkit/WindowsCommunityToolkit-design-assets)
|
||||
- [ ] New major technical changes in the toolkit have or will be added to the [Wiki](https://github.com/windows-toolkit/WindowsCommunityToolkit/wiki) e.g. build changes, source generators, testing infrastructure, sample creation changes, etc...
|
||||
- [ ] Tests for the changes have been added (for bug fixes / features) (if applicable)
|
||||
- [ ] Header has been added to all new source files (run *build/UpdateHeaders.bat*)
|
||||
- [ ] Contains **NO** breaking changes
|
||||
|
|
|
@ -14,8 +14,9 @@
|
|||
<IsTestProject>$(MSBuildProjectName.Contains('Test'))</IsTestProject>
|
||||
<IsUwpProject Condition="'$(IsDesignProject)' != 'true'">$(MSBuildProjectName.Contains('Uwp'))</IsUwpProject>
|
||||
<IsSampleProject>$(MSBuildProjectName.Contains('Sample'))</IsSampleProject>
|
||||
<DefaultTargetPlatformVersion>19041</DefaultTargetPlatformVersion>
|
||||
<DefaultTargetPlatformMinVersion>17763</DefaultTargetPlatformMinVersion>
|
||||
<TargetPlatformBaseVersion>10.0</TargetPlatformBaseVersion>
|
||||
<TargetPlatformRevision>19041</TargetPlatformRevision>
|
||||
<TargetPlatformMinRevision>17763</TargetPlatformMinRevision>
|
||||
<PackageOutputPath>$(MSBuildThisFileDirectory)bin\nupkg</PackageOutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
|
@ -88,7 +89,6 @@
|
|||
</Choose>
|
||||
|
||||
<PropertyGroup Condition="'$(IsUwpProject)' == 'true'">
|
||||
|
||||
<!-- 8002 is a strong named -> non-strong-named reference -->
|
||||
<!-- This is valid for platforms other than .NET Framework (and is needed for the UWP targets -->
|
||||
<NoWarn>$(NoWarn);8002</NoWarn>
|
||||
|
@ -103,4 +103,7 @@
|
|||
<Link>stylecop.json</Link>
|
||||
</AdditionalFiles>
|
||||
</ItemGroup>
|
||||
|
||||
<Import Project="$(MSBuildThisFileDirectory)build\Windows.Toolkit.VisualStudio.Design.props" Condition="'$(IsDesignProject)' == 'true'"/>
|
||||
|
||||
</Project>
|
|
@ -1,26 +1,11 @@
|
|||
<Project>
|
||||
<Choose>
|
||||
<When Condition="'$(TargetFramework)' == 'uap10.0' or '$(TargetFramework)' == 'uap10.0.17763' or '$(TargetFramework)' == 'native' or '$(TargetFramework)' == 'net461'">
|
||||
<!-- UAP versions for uap10.0 where TPMV isn't implied -->
|
||||
<PropertyGroup>
|
||||
<TargetPlatformVersion>10.0.$(DefaultTargetPlatformVersion).0</TargetPlatformVersion>
|
||||
<TargetPlatformMinVersion>10.0.$(DefaultTargetPlatformMinVersion).0</TargetPlatformMinVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(DebugType)' == ''">
|
||||
<DebugType>Portable</DebugType>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<UseUWP Condition="'$(TargetFramework)' == 'uap10.0' or '$(TargetFramework)' == 'uap10.0.17763' or '$(TargetFramework)' == 'native' or '$(TargetFramework)' == 'net461'">true</UseUWP>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<SDKReference Condition="'$(UseWindowsDesktopSdk)' == 'true' " Include="WindowsDesktop, Version=$(TargetPlatformVersion)">
|
||||
<Name>Windows Desktop Extensions for the UWP</Name>
|
||||
</SDKReference>
|
||||
</ItemGroup>
|
||||
</When>
|
||||
</Choose>
|
||||
|
||||
<Choose>
|
||||
<When Condition="'$(TargetFramework.Contains(`uap10.0`))' == 'false' and '$(TargetFramework)' != 'native' and '$(IsSampleProject)' != 'true'">
|
||||
<When Condition="!$(TargetFramework.Contains(`uap10.0`)) and '$(TargetFramework)' != 'native' and '$(IsSampleProject)' != 'true'">
|
||||
<PropertyGroup>
|
||||
<SignAssembly>true</SignAssembly>
|
||||
<AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)toolkit.snk</AssemblyOriginatorKeyFile>
|
||||
|
@ -28,6 +13,8 @@
|
|||
</When>
|
||||
</Choose>
|
||||
|
||||
<Import Project="$(MSBuildThisFileDirectory)build\Windows.Toolkit.Uwp.Build.targets" Condition="'$(UseUWP)' == 'true'"/>
|
||||
|
||||
<Target Name="AddCommitHashToAssemblyAttributes" BeforeTargets="GetAssemblyAttributes">
|
||||
<ItemGroup>
|
||||
<AssemblyAttribute Include="System.Reflection.AssemblyMetadataAttribute" Condition=" '$(SourceRevisionId)' != '' ">
|
||||
|
@ -36,4 +23,5 @@
|
|||
</AssemblyAttribute>
|
||||
</ItemGroup>
|
||||
</Target>
|
||||
|
||||
</Project>
|
|
@ -0,0 +1,28 @@
|
|||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
#if !NET5_0
|
||||
|
||||
namespace System.Runtime.CompilerServices
|
||||
{
|
||||
/// <summary>
|
||||
/// Used to indicate to the compiler that the <c>.locals init</c> flag should not be set in method headers.
|
||||
/// </summary>
|
||||
/// <remarks>Internal copy of the .NET 5 attribute.</remarks>
|
||||
[AttributeUsage(
|
||||
AttributeTargets.Module |
|
||||
AttributeTargets.Class |
|
||||
AttributeTargets.Struct |
|
||||
AttributeTargets.Interface |
|
||||
AttributeTargets.Constructor |
|
||||
AttributeTargets.Method |
|
||||
AttributeTargets.Property |
|
||||
AttributeTargets.Event,
|
||||
Inherited = false)]
|
||||
internal sealed class SkipLocalsInitAttribute : Attribute
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
|
@ -7,7 +7,7 @@ using System.Buffers;
|
|||
using System.Diagnostics;
|
||||
using System.Diagnostics.Contracts;
|
||||
using System.Runtime.CompilerServices;
|
||||
#if NETCORE_RUNTIME
|
||||
#if NETCORE_RUNTIME || NET5_0
|
||||
using System.Runtime.InteropServices;
|
||||
#endif
|
||||
using Microsoft.Toolkit.HighPerformance.Buffers.Views;
|
||||
|
@ -183,7 +183,7 @@ namespace Microsoft.Toolkit.HighPerformance.Buffers
|
|||
ThrowObjectDisposedException();
|
||||
}
|
||||
|
||||
#if NETCORE_RUNTIME
|
||||
#if NETCORE_RUNTIME || NET5_0
|
||||
ref T r0 = ref array!.DangerousGetReferenceAt(this.start);
|
||||
|
||||
// On .NET Core runtimes, we can manually create a span from the starting reference to
|
||||
|
|
|
@ -7,7 +7,7 @@ using System.Buffers;
|
|||
using System.Diagnostics;
|
||||
using System.Diagnostics.Contracts;
|
||||
using System.Runtime.CompilerServices;
|
||||
#if NETCORE_RUNTIME
|
||||
#if NETCORE_RUNTIME || NET5_0
|
||||
using System.Runtime.InteropServices;
|
||||
#endif
|
||||
using Microsoft.Toolkit.HighPerformance.Buffers.Views;
|
||||
|
@ -148,7 +148,7 @@ namespace Microsoft.Toolkit.HighPerformance.Buffers
|
|||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get
|
||||
{
|
||||
#if NETCORE_RUNTIME
|
||||
#if NETCORE_RUNTIME || NET5_0
|
||||
ref T r0 = ref array!.DangerousGetReference();
|
||||
|
||||
return MemoryMarshal.CreateSpan(ref r0, this.length);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
using System;
|
||||
using System.Diagnostics.Contracts;
|
||||
using System.Runtime.CompilerServices;
|
||||
#if NETCORE_RUNTIME
|
||||
#if NETCORE_RUNTIME || NET5_0
|
||||
using System.Runtime.InteropServices;
|
||||
#endif
|
||||
using Microsoft.Toolkit.HighPerformance.Enumerables;
|
||||
|
@ -30,7 +30,9 @@ namespace Microsoft.Toolkit.HighPerformance.Extensions
|
|||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static ref T DangerousGetReference<T>(this T[] array)
|
||||
{
|
||||
#if NETCORE_RUNTIME
|
||||
#if NET5_0
|
||||
return ref MemoryMarshal.GetArrayDataReference(array);
|
||||
#elif NETCORE_RUNTIME
|
||||
var arrayData = Unsafe.As<RawArrayData>(array)!;
|
||||
ref T r0 = ref Unsafe.As<byte, T>(ref arrayData.Data);
|
||||
|
||||
|
@ -54,7 +56,12 @@ namespace Microsoft.Toolkit.HighPerformance.Extensions
|
|||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static ref T DangerousGetReferenceAt<T>(this T[] array, int i)
|
||||
{
|
||||
#if NETCORE_RUNTIME
|
||||
#if NET5_0
|
||||
ref T r0 = ref MemoryMarshal.GetArrayDataReference(array);
|
||||
ref T ri = ref Unsafe.Add(ref r0, (nint)(uint)i);
|
||||
|
||||
return ref ri;
|
||||
#elif NETCORE_RUNTIME
|
||||
var arrayData = Unsafe.As<RawArrayData>(array)!;
|
||||
ref T r0 = ref Unsafe.As<byte, T>(ref arrayData.Data);
|
||||
ref T ri = ref Unsafe.Add(ref r0, (nint)(uint)i);
|
||||
|
@ -203,7 +210,7 @@ namespace Microsoft.Toolkit.HighPerformance.Extensions
|
|||
/// <summary>
|
||||
/// Throws an <see cref="OverflowException"/> when the "column" parameter is invalid.
|
||||
/// </summary>
|
||||
public static void ThrowOverflowException()
|
||||
private static void ThrowOverflowException()
|
||||
{
|
||||
throw new OverflowException();
|
||||
}
|
||||
|
|
|
@ -451,7 +451,7 @@ namespace Microsoft.Toolkit.HighPerformance.Extensions
|
|||
/// <summary>
|
||||
/// Throws an <see cref="ArgumentOutOfRangeException"/> when the "row" parameter is invalid.
|
||||
/// </summary>
|
||||
public static void ThrowArgumentOutOfRangeExceptionForRow()
|
||||
private static void ThrowArgumentOutOfRangeExceptionForRow()
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("row");
|
||||
}
|
||||
|
@ -459,7 +459,7 @@ namespace Microsoft.Toolkit.HighPerformance.Extensions
|
|||
/// <summary>
|
||||
/// Throws an <see cref="ArgumentOutOfRangeException"/> when the "column" parameter is invalid.
|
||||
/// </summary>
|
||||
public static void ThrowArgumentOutOfRangeExceptionForColumn()
|
||||
private static void ThrowArgumentOutOfRangeExceptionForColumn()
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("column");
|
||||
}
|
||||
|
|
|
@ -316,7 +316,7 @@ namespace Microsoft.Toolkit.HighPerformance.Extensions
|
|||
/// <summary>
|
||||
/// Throws an <see cref="ArgumentOutOfRangeException"/> when the "depth" parameter is invalid.
|
||||
/// </summary>
|
||||
public static void ThrowArgumentOutOfRangeExceptionForDepth()
|
||||
private static void ThrowArgumentOutOfRangeExceptionForDepth()
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("depth");
|
||||
}
|
||||
|
|
|
@ -21,9 +21,9 @@ namespace Microsoft.Toolkit.HighPerformance.Extensions
|
|||
/// <remarks>This method does not contain branching instructions.</remarks>
|
||||
[Pure]
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static byte ToByte(this bool flag)
|
||||
public static unsafe byte ToByte(this bool flag)
|
||||
{
|
||||
return Unsafe.As<bool, byte>(ref flag);
|
||||
return *(byte*)&flag;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -35,9 +35,9 @@ namespace Microsoft.Toolkit.HighPerformance.Extensions
|
|||
[Pure]
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
[Obsolete("Use ToByte instead.")]
|
||||
public static int ToInt(this bool flag)
|
||||
public static unsafe int ToInt(this bool flag)
|
||||
{
|
||||
return Unsafe.As<bool, byte>(ref flag);
|
||||
return *(byte*)&flag;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -56,9 +56,9 @@ namespace Microsoft.Toolkit.HighPerformance.Extensions
|
|||
/// </remarks>
|
||||
[Pure]
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static int ToBitwiseMask32(this bool flag)
|
||||
public static unsafe int ToBitwiseMask32(this bool flag)
|
||||
{
|
||||
byte rangeFlag = Unsafe.As<bool, byte>(ref flag);
|
||||
byte rangeFlag = *(byte*)&flag;
|
||||
int
|
||||
negativeFlag = rangeFlag - 1,
|
||||
mask = ~negativeFlag;
|
||||
|
@ -75,9 +75,9 @@ namespace Microsoft.Toolkit.HighPerformance.Extensions
|
|||
/// <remarks>This method does not contain branching instructions. See additional note in <see cref="ToBitwiseMask32"/>.</remarks>
|
||||
[Pure]
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static long ToBitwiseMask64(this bool flag)
|
||||
public static unsafe long ToBitwiseMask64(this bool flag)
|
||||
{
|
||||
byte rangeFlag = Unsafe.As<bool, byte>(ref flag);
|
||||
byte rangeFlag = *(byte*)&flag;
|
||||
long
|
||||
negativeFlag = (long)rangeFlag - 1,
|
||||
mask = ~negativeFlag;
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
#if NET5_0
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Contracts;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Microsoft.Toolkit.HighPerformance.Extensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Helpers for working with the <see cref="List{T}"/> type.
|
||||
/// </summary>
|
||||
public static class ListExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="Span{T}"/> over an input <see cref="List{T}"/> instance.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of elements in the input <see cref="List{T}"/> instance.</typeparam>
|
||||
/// <param name="list">The input <see cref="List{T}"/> instance.</param>
|
||||
/// <returns>A <see cref="Span{T}"/> instance with the values of <paramref name="list"/>.</returns>
|
||||
/// <remarks>
|
||||
/// Note that the returned <see cref="Span{T}"/> is only guaranteed to be valid as long as the items within
|
||||
/// <paramref name="list"/> are not modified. Doing so might cause the <see cref="List{T}"/> to swap its
|
||||
/// internal buffer, causing the returned <see cref="Span{T}"/> to become out of date. That means that in this
|
||||
/// scenario, the <see cref="Span{T}"/> would end up wrapping an array no longer in use. Always make sure to use
|
||||
/// the returned <see cref="Span{T}"/> while the target <see cref="List{T}"/> is not modified.
|
||||
/// </remarks>
|
||||
[Pure]
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static Span<T> AsSpan<T>(this List<T>? list)
|
||||
{
|
||||
return CollectionsMarshal.AsSpan(list);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
|
@ -138,7 +138,7 @@ namespace Microsoft.Toolkit.HighPerformance.Extensions
|
|||
/// </returns>
|
||||
[Pure]
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static ref readonly T DangerousGetLookupReferenceAt<T>(this ReadOnlySpan<T> span, int i)
|
||||
public static unsafe ref readonly T DangerousGetLookupReferenceAt<T>(this ReadOnlySpan<T> span, int i)
|
||||
{
|
||||
// Check whether the input is in range by first casting both
|
||||
// operands to uint and then comparing them, as this allows
|
||||
|
@ -156,7 +156,7 @@ namespace Microsoft.Toolkit.HighPerformance.Extensions
|
|||
// bounds unless the input span was just empty, which for a
|
||||
// lookup table can just be assumed to always be false.
|
||||
bool isInRange = (uint)i < (uint)span.Length;
|
||||
byte rangeFlag = Unsafe.As<bool, byte>(ref isInRange);
|
||||
byte rangeFlag = *(byte*)&isInRange;
|
||||
uint
|
||||
negativeFlag = unchecked(rangeFlag - 1u),
|
||||
mask = ~negativeFlag,
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
using System;
|
||||
using System.Diagnostics.Contracts;
|
||||
using System.Runtime.CompilerServices;
|
||||
#if !NETCOREAPP3_1
|
||||
#if NETCOREAPP2_1 || NETSTANDARD
|
||||
using System.Runtime.InteropServices;
|
||||
#endif
|
||||
using Microsoft.Toolkit.HighPerformance.Enumerables;
|
||||
|
@ -28,7 +28,7 @@ namespace Microsoft.Toolkit.HighPerformance.Extensions
|
|||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static ref char DangerousGetReference(this string text)
|
||||
{
|
||||
#if NETCOREAPP3_1
|
||||
#if NETCOREAPP3_1 || NET5_0
|
||||
return ref Unsafe.AsRef(text.GetPinnableReference());
|
||||
#elif NETCOREAPP2_1
|
||||
var stringData = Unsafe.As<RawStringData>(text)!;
|
||||
|
@ -50,7 +50,7 @@ namespace Microsoft.Toolkit.HighPerformance.Extensions
|
|||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static ref char DangerousGetReferenceAt(this string text, int i)
|
||||
{
|
||||
#if NETCOREAPP3_1
|
||||
#if NETCOREAPP3_1 || NET5_0
|
||||
ref char r0 = ref Unsafe.AsRef(text.GetPinnableReference());
|
||||
#elif NETCOREAPP2_1
|
||||
ref char r0 = ref Unsafe.As<RawStringData>(text)!.Data;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
using System.Diagnostics.Contracts;
|
||||
using System.Runtime.CompilerServices;
|
||||
#if NETCOREAPP3_1
|
||||
#if NETCOREAPP3_1 || NET5_0
|
||||
using System.Runtime.Intrinsics.X86;
|
||||
#endif
|
||||
|
||||
|
@ -28,7 +28,7 @@ namespace Microsoft.Toolkit.HighPerformance.Helpers
|
|||
/// </remarks>
|
||||
[Pure]
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static bool HasFlag(uint value, int n)
|
||||
public static unsafe bool HasFlag(uint value, int n)
|
||||
{
|
||||
// Read the n-th bit, downcast to byte
|
||||
byte flag = (byte)((value >> n) & 1);
|
||||
|
@ -40,7 +40,7 @@ namespace Microsoft.Toolkit.HighPerformance.Helpers
|
|||
// compared the previous computed flag against 0, the assembly
|
||||
// would have had to perform the test, set the non-zero
|
||||
// flag and then extend the (byte) result to eax.
|
||||
return Unsafe.As<byte, bool>(ref flag);
|
||||
return *(bool*)&flag;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -74,7 +74,7 @@ namespace Microsoft.Toolkit.HighPerformance.Helpers
|
|||
/// </remarks>
|
||||
[Pure]
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static bool HasLookupFlag(uint table, int x, int min = 0)
|
||||
public static unsafe bool HasLookupFlag(uint table, int x, int min = 0)
|
||||
{
|
||||
// First, the input value is scaled down by the given minimum.
|
||||
// This step will be skipped entirely if min is just the default of 0.
|
||||
|
@ -91,14 +91,14 @@ namespace Microsoft.Toolkit.HighPerformance.Helpers
|
|||
// as a bool just like in the HasFlag method above, and then returned.
|
||||
int i = x - min;
|
||||
bool isInRange = (uint)i < 32u;
|
||||
byte byteFlag = Unsafe.As<bool, byte>(ref isInRange);
|
||||
byte byteFlag = *(byte*)&isInRange;
|
||||
int
|
||||
negativeFlag = byteFlag - 1,
|
||||
mask = ~negativeFlag,
|
||||
shift = unchecked((int)((table >> i) & 1)),
|
||||
and = shift & mask;
|
||||
byte result = unchecked((byte)and);
|
||||
bool valid = Unsafe.As<byte, bool>(ref result);
|
||||
bool valid = *(bool*)&result;
|
||||
|
||||
return valid;
|
||||
}
|
||||
|
@ -194,7 +194,7 @@ namespace Microsoft.Toolkit.HighPerformance.Helpers
|
|||
/// </remarks>
|
||||
[Pure]
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static uint SetFlag(uint value, int n, bool flag)
|
||||
public static unsafe uint SetFlag(uint value, int n, bool flag)
|
||||
{
|
||||
// Shift a bit left to the n-th position, negate the
|
||||
// resulting value and perform an AND with the input value.
|
||||
|
@ -210,7 +210,7 @@ namespace Microsoft.Toolkit.HighPerformance.Helpers
|
|||
// operation. This will always guaranteed to work, thanks to the
|
||||
// initial code clearing that bit before setting it again.
|
||||
uint
|
||||
flag32 = Unsafe.As<bool, byte>(ref flag),
|
||||
flag32 = *(byte*)&flag,
|
||||
shift = flag32 << n,
|
||||
or = and | shift;
|
||||
|
||||
|
@ -235,7 +235,7 @@ namespace Microsoft.Toolkit.HighPerformance.Helpers
|
|||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static uint ExtractRange(uint value, byte start, byte length)
|
||||
{
|
||||
#if NETCOREAPP3_1
|
||||
#if NETCOREAPP3_1 || NET5_0
|
||||
if (Bmi1.IsSupported)
|
||||
{
|
||||
return Bmi1.BitFieldExtract(value, start, length);
|
||||
|
@ -283,7 +283,7 @@ namespace Microsoft.Toolkit.HighPerformance.Helpers
|
|||
loadMask = highBits << start,
|
||||
storeMask = (flags & highBits) << start;
|
||||
|
||||
#if NETCOREAPP3_1
|
||||
#if NETCOREAPP3_1 || NET5_0
|
||||
if (Bmi1.IsSupported)
|
||||
{
|
||||
return Bmi1.AndNot(loadMask, value) | storeMask;
|
||||
|
@ -306,12 +306,12 @@ namespace Microsoft.Toolkit.HighPerformance.Helpers
|
|||
/// </remarks>
|
||||
[Pure]
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static bool HasFlag(ulong value, int n)
|
||||
public static unsafe bool HasFlag(ulong value, int n)
|
||||
{
|
||||
// Same logic as the uint version, see that for more info
|
||||
byte flag = (byte)((value >> n) & 1);
|
||||
|
||||
return Unsafe.As<byte, bool>(ref flag);
|
||||
return *(bool*)&flag;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -328,18 +328,18 @@ namespace Microsoft.Toolkit.HighPerformance.Helpers
|
|||
/// </remarks>
|
||||
[Pure]
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static bool HasLookupFlag(ulong table, int x, int min = 0)
|
||||
public static unsafe bool HasLookupFlag(ulong table, int x, int min = 0)
|
||||
{
|
||||
int i = x - min;
|
||||
bool isInRange = (uint)i < 64u;
|
||||
byte byteFlag = Unsafe.As<bool, byte>(ref isInRange);
|
||||
byte byteFlag = *(byte*)&isInRange;
|
||||
int
|
||||
negativeFlag = byteFlag - 1,
|
||||
mask = ~negativeFlag,
|
||||
shift = unchecked((int)((table >> i) & 1)),
|
||||
and = shift & mask;
|
||||
byte result = unchecked((byte)and);
|
||||
bool valid = Unsafe.As<byte, bool>(ref result);
|
||||
bool valid = *(bool*)&result;
|
||||
|
||||
return valid;
|
||||
}
|
||||
|
@ -373,13 +373,13 @@ namespace Microsoft.Toolkit.HighPerformance.Helpers
|
|||
/// </remarks>
|
||||
[Pure]
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static ulong SetFlag(ulong value, int n, bool flag)
|
||||
public static unsafe ulong SetFlag(ulong value, int n, bool flag)
|
||||
{
|
||||
ulong
|
||||
bit = 1ul << n,
|
||||
not = ~bit,
|
||||
and = value & not,
|
||||
flag64 = Unsafe.As<bool, byte>(ref flag),
|
||||
flag64 = *(byte*)&flag,
|
||||
shift = flag64 << n,
|
||||
or = and | shift;
|
||||
|
||||
|
@ -404,7 +404,7 @@ namespace Microsoft.Toolkit.HighPerformance.Helpers
|
|||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static ulong ExtractRange(ulong value, byte start, byte length)
|
||||
{
|
||||
#if NETCOREAPP3_1
|
||||
#if NETCOREAPP3_1 || NET5_0
|
||||
if (Bmi1.X64.IsSupported)
|
||||
{
|
||||
return Bmi1.X64.BitFieldExtract(value, start, length);
|
||||
|
@ -452,7 +452,7 @@ namespace Microsoft.Toolkit.HighPerformance.Helpers
|
|||
loadMask = highBits << start,
|
||||
storeMask = (flags & highBits) << start;
|
||||
|
||||
#if NETCOREAPP3_1
|
||||
#if NETCOREAPP3_1 || NET5_0
|
||||
if (Bmi1.X64.IsSupported)
|
||||
{
|
||||
return Bmi1.X64.AndNot(loadMask, value) | storeMask;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
using System.Diagnostics.Contracts;
|
||||
using System.Runtime.CompilerServices;
|
||||
#if NETCOREAPP3_1
|
||||
#if NETCOREAPP3_1 || NET5_0
|
||||
using static System.Numerics.BitOperations;
|
||||
#endif
|
||||
|
||||
|
@ -25,7 +25,7 @@ namespace Microsoft.Toolkit.HighPerformance.Helpers.Internals
|
|||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static int RoundUpPowerOfTwo(int x)
|
||||
{
|
||||
#if NETCOREAPP3_1
|
||||
#if NETCOREAPP3_1 || NET5_0
|
||||
return 1 << (32 - LeadingZeroCount((uint)(x - 1)));
|
||||
#else
|
||||
x--;
|
||||
|
|
|
@ -42,7 +42,7 @@ namespace Microsoft.Toolkit.HighPerformance.Helpers.Internals
|
|||
}
|
||||
else if (sizeof(TFrom) == 1)
|
||||
{
|
||||
return length / sizeof(TTo);
|
||||
return (int)((uint)length / (uint)sizeof(TTo));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
|
|
|
@ -143,12 +143,14 @@ namespace Microsoft.Toolkit.HighPerformance.Helpers
|
|||
end = Math.Min(high, this.memory.Length);
|
||||
|
||||
ref TItem r0 = ref MemoryMarshal.GetReference(this.memory.Span);
|
||||
ref TItem rStart = ref Unsafe.Add(ref r0, low);
|
||||
ref TItem rEnd = ref Unsafe.Add(ref r0, end);
|
||||
|
||||
for (int j = low; j < end; j++)
|
||||
while (Unsafe.IsAddressLessThan(ref rStart, ref rEnd))
|
||||
{
|
||||
ref TItem rj = ref Unsafe.Add(ref r0, (nint)(uint)j);
|
||||
Unsafe.AsRef(this.action).Invoke(in rStart);
|
||||
|
||||
Unsafe.AsRef(this.action).Invoke(rj);
|
||||
rStart = ref Unsafe.Add(ref rStart, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -145,13 +145,14 @@ namespace Microsoft.Toolkit.HighPerformance.Helpers
|
|||
|
||||
for (int y = lowY; y < stopY; y++)
|
||||
{
|
||||
ref TItem r0 = ref span.DangerousGetReferenceAt(y, 0);
|
||||
ref TItem rStart = ref span.DangerousGetReferenceAt(y, 0);
|
||||
ref TItem rEnd = ref Unsafe.Add(ref rStart, width);
|
||||
|
||||
for (int x = 0; x < width; x++)
|
||||
while (Unsafe.IsAddressLessThan(ref rStart, ref rEnd))
|
||||
{
|
||||
ref TItem ryx = ref Unsafe.Add(ref r0, (nint)(uint)x);
|
||||
Unsafe.AsRef(this.action).Invoke(in rStart);
|
||||
|
||||
Unsafe.AsRef(this.action).Invoke(ryx);
|
||||
rStart = ref Unsafe.Add(ref rStart, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -143,12 +143,14 @@ namespace Microsoft.Toolkit.HighPerformance.Helpers
|
|||
end = Math.Min(high, this.memory.Length);
|
||||
|
||||
ref TItem r0 = ref MemoryMarshal.GetReference(this.memory.Span);
|
||||
ref TItem rStart = ref Unsafe.Add(ref r0, low);
|
||||
ref TItem rEnd = ref Unsafe.Add(ref r0, end);
|
||||
|
||||
for (int j = low; j < end; j++)
|
||||
while (Unsafe.IsAddressLessThan(ref rStart, ref rEnd))
|
||||
{
|
||||
ref TItem rj = ref Unsafe.Add(ref r0, (nint)(uint)j);
|
||||
Unsafe.AsRef(this.action).Invoke(ref rStart);
|
||||
|
||||
Unsafe.AsRef(this.action).Invoke(ref rj);
|
||||
rStart = ref Unsafe.Add(ref rStart, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -152,13 +152,14 @@ namespace Microsoft.Toolkit.HighPerformance.Helpers
|
|||
|
||||
for (int y = lowY; y < stopY; y++)
|
||||
{
|
||||
ref TItem r0 = ref span.DangerousGetReferenceAt(y, 0);
|
||||
ref TItem rStart = ref span.DangerousGetReferenceAt(y, 0);
|
||||
ref TItem rEnd = ref Unsafe.Add(ref rStart, width);
|
||||
|
||||
for (int x = 0; x < width; x++)
|
||||
while (Unsafe.IsAddressLessThan(ref rStart, ref rEnd))
|
||||
{
|
||||
ref TItem ryx = ref Unsafe.Add(ref r0, (nint)(uint)x);
|
||||
Unsafe.AsRef(this.action).Invoke(ref rStart);
|
||||
|
||||
Unsafe.AsRef(this.action).Invoke(ref ryx);
|
||||
rStart = ref Unsafe.Add(ref rStart, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,6 +17,8 @@ using Microsoft.Toolkit.HighPerformance.Memory.Internals;
|
|||
using Microsoft.Toolkit.HighPerformance.Memory.Views;
|
||||
using static Microsoft.Toolkit.HighPerformance.Helpers.Internals.RuntimeHelpers;
|
||||
|
||||
#pragma warning disable CA2231
|
||||
|
||||
namespace Microsoft.Toolkit.HighPerformance.Memory
|
||||
{
|
||||
/// <summary>
|
||||
|
@ -601,7 +603,7 @@ namespace Microsoft.Toolkit.HighPerformance.Memory
|
|||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get
|
||||
{
|
||||
if (!(this.instance is null))
|
||||
if (this.instance is not null)
|
||||
{
|
||||
#if SPAN_RUNTIME_SUPPORT
|
||||
if (this.instance is MemoryManager<T> memoryManager)
|
||||
|
@ -738,7 +740,7 @@ namespace Microsoft.Toolkit.HighPerformance.Memory
|
|||
/// <returns>A <see cref="MemoryHandle"/> instance wrapping the pinned handle.</returns>
|
||||
public unsafe MemoryHandle Pin()
|
||||
{
|
||||
if (!(this.instance is null))
|
||||
if (this.instance is not null)
|
||||
{
|
||||
if (this.instance is MemoryManager<T> memoryManager)
|
||||
{
|
||||
|
@ -863,7 +865,7 @@ namespace Microsoft.Toolkit.HighPerformance.Memory
|
|||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public override int GetHashCode()
|
||||
{
|
||||
if (!(this.instance is null))
|
||||
if (this.instance is not null)
|
||||
{
|
||||
#if !NETSTANDARD1_4
|
||||
return HashCode.Combine(
|
||||
|
|
|
@ -17,6 +17,8 @@ using Microsoft.Toolkit.HighPerformance.Memory.Internals;
|
|||
using Microsoft.Toolkit.HighPerformance.Memory.Views;
|
||||
using static Microsoft.Toolkit.HighPerformance.Helpers.Internals.RuntimeHelpers;
|
||||
|
||||
#pragma warning disable CA2231
|
||||
|
||||
namespace Microsoft.Toolkit.HighPerformance.Memory
|
||||
{
|
||||
/// <summary>
|
||||
|
@ -615,7 +617,7 @@ namespace Microsoft.Toolkit.HighPerformance.Memory
|
|||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get
|
||||
{
|
||||
if (!(this.instance is null))
|
||||
if (this.instance is not null)
|
||||
{
|
||||
#if SPAN_RUNTIME_SUPPORT
|
||||
if (this.instance is MemoryManager<T> memoryManager)
|
||||
|
@ -753,7 +755,7 @@ namespace Microsoft.Toolkit.HighPerformance.Memory
|
|||
/// <returns>A <see cref="MemoryHandle"/> instance wrapping the pinned handle.</returns>
|
||||
public unsafe MemoryHandle Pin()
|
||||
{
|
||||
if (!(this.instance is null))
|
||||
if (this.instance is not null)
|
||||
{
|
||||
if (this.instance is MemoryManager<T> memoryManager)
|
||||
{
|
||||
|
@ -876,7 +878,7 @@ namespace Microsoft.Toolkit.HighPerformance.Memory
|
|||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public override int GetHashCode()
|
||||
{
|
||||
if (!(this.instance is null))
|
||||
if (this.instance is not null)
|
||||
{
|
||||
#if !NETSTANDARD1_4
|
||||
return HashCode.Combine(
|
||||
|
|
|
@ -15,6 +15,8 @@ using Microsoft.Toolkit.HighPerformance.Memory.Views;
|
|||
using RuntimeHelpers = Microsoft.Toolkit.HighPerformance.Helpers.Internals.RuntimeHelpers;
|
||||
#endif
|
||||
|
||||
#pragma warning disable CS0809, CA1065
|
||||
|
||||
namespace Microsoft.Toolkit.HighPerformance.Memory
|
||||
{
|
||||
/// <summary>
|
||||
|
@ -626,15 +628,18 @@ namespace Microsoft.Toolkit.HighPerformance.Memory
|
|||
nint width = (nint)(uint)this.width;
|
||||
|
||||
ref T destinationRef = ref MemoryMarshal.GetReference(destination);
|
||||
nint offset = 0;
|
||||
|
||||
for (int i = 0; i < height; i++)
|
||||
{
|
||||
ref T sourceRef = ref DangerousGetReferenceAt(i, 0);
|
||||
ref T sourceStart = ref DangerousGetReferenceAt(i, 0);
|
||||
ref T sourceEnd = ref Unsafe.Add(ref sourceStart, width);
|
||||
|
||||
for (nint j = 0; j < width; j += 1, offset += 1)
|
||||
while (Unsafe.IsAddressLessThan(ref sourceStart, ref sourceEnd))
|
||||
{
|
||||
Unsafe.Add(ref destinationRef, offset) = Unsafe.Add(ref sourceRef, j);
|
||||
destinationRef = sourceStart;
|
||||
|
||||
sourceStart = ref Unsafe.Add(ref sourceStart, 1);
|
||||
destinationRef = ref Unsafe.Add(ref destinationRef, 1);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -680,12 +685,16 @@ namespace Microsoft.Toolkit.HighPerformance.Memory
|
|||
|
||||
for (int i = 0; i < height; i++)
|
||||
{
|
||||
ref T sourceRef = ref DangerousGetReferenceAt(i, 0);
|
||||
ref T sourceStart = ref DangerousGetReferenceAt(i, 0);
|
||||
ref T sourceEnd = ref Unsafe.Add(ref sourceStart, width);
|
||||
ref T destinationRef = ref destination.DangerousGetReferenceAt(i, 0);
|
||||
|
||||
for (nint j = 0; j < width; j += 1)
|
||||
while (Unsafe.IsAddressLessThan(ref sourceStart, ref sourceEnd))
|
||||
{
|
||||
Unsafe.Add(ref destinationRef, j) = Unsafe.Add(ref sourceRef, j);
|
||||
destinationRef = sourceStart;
|
||||
|
||||
sourceStart = ref Unsafe.Add(ref sourceStart, 1);
|
||||
destinationRef = ref Unsafe.Add(ref destinationRef, 1);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -926,15 +935,18 @@ namespace Microsoft.Toolkit.HighPerformance.Memory
|
|||
nint width = (nint)(uint)this.width;
|
||||
|
||||
ref T destinationRef = ref array.DangerousGetReference();
|
||||
nint offset = 0;
|
||||
|
||||
for (int i = 0; i < height; i++)
|
||||
{
|
||||
ref T sourceRef = ref DangerousGetReferenceAt(i, 0);
|
||||
ref T sourceStart = ref DangerousGetReferenceAt(i, 0);
|
||||
ref T sourceEnd = ref Unsafe.Add(ref sourceStart, width);
|
||||
|
||||
for (nint j = 0; j < width; j += 1, offset += 1)
|
||||
while (Unsafe.IsAddressLessThan(ref sourceStart, ref sourceEnd))
|
||||
{
|
||||
Unsafe.Add(ref destinationRef, offset) = Unsafe.Add(ref sourceRef, j);
|
||||
destinationRef = sourceStart;
|
||||
|
||||
sourceStart = ref Unsafe.Add(ref sourceStart, 1);
|
||||
destinationRef = ref Unsafe.Add(ref destinationRef, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -943,7 +955,6 @@ namespace Microsoft.Toolkit.HighPerformance.Memory
|
|||
return array;
|
||||
}
|
||||
|
||||
#pragma warning disable CS0809 // Obsolete member overrides non-obsolete member
|
||||
/// <inheritdoc cref="ReadOnlySpan{T}.Equals(object)"/>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
[Obsolete("Equals() on Span will always throw an exception. Use == instead.")]
|
||||
|
@ -959,7 +970,6 @@ namespace Microsoft.Toolkit.HighPerformance.Memory
|
|||
{
|
||||
throw new NotSupportedException("Microsoft.Toolkit.HighPerformance.ReadOnlySpan2D<T>.GetHashCode() is not supported");
|
||||
}
|
||||
#pragma warning restore CS0809
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override string ToString()
|
||||
|
|
|
@ -15,6 +15,8 @@ using Microsoft.Toolkit.HighPerformance.Memory.Views;
|
|||
using RuntimeHelpers = Microsoft.Toolkit.HighPerformance.Helpers.Internals.RuntimeHelpers;
|
||||
#endif
|
||||
|
||||
#pragma warning disable CS0809, CA1065
|
||||
|
||||
namespace Microsoft.Toolkit.HighPerformance.Memory
|
||||
{
|
||||
/// <summary>
|
||||
|
@ -689,11 +691,14 @@ namespace Microsoft.Toolkit.HighPerformance.Memory
|
|||
|
||||
for (int i = 0; i < height; i++)
|
||||
{
|
||||
ref T r0 = ref DangerousGetReferenceAt(i, 0);
|
||||
ref T rStart = ref DangerousGetReferenceAt(i, 0);
|
||||
ref T rEnd = ref Unsafe.Add(ref rStart, width);
|
||||
|
||||
for (nint j = 0; j < width; j += 1)
|
||||
while (Unsafe.IsAddressLessThan(ref rStart, ref rEnd))
|
||||
{
|
||||
Unsafe.Add(ref r0, j) = default!;
|
||||
rStart = default!;
|
||||
|
||||
rStart = ref Unsafe.Add(ref rStart, 1);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -736,15 +741,18 @@ namespace Microsoft.Toolkit.HighPerformance.Memory
|
|||
nint width = (nint)(uint)this.width;
|
||||
|
||||
ref T destinationRef = ref MemoryMarshal.GetReference(destination);
|
||||
nint offset = 0;
|
||||
|
||||
for (int i = 0; i < height; i++)
|
||||
{
|
||||
ref T sourceRef = ref DangerousGetReferenceAt(i, 0);
|
||||
ref T sourceStart = ref DangerousGetReferenceAt(i, 0);
|
||||
ref T sourceEnd = ref Unsafe.Add(ref sourceStart, width);
|
||||
|
||||
for (nint j = 0; j < width; j += 1, offset += 1)
|
||||
while (Unsafe.IsAddressLessThan(ref sourceStart, ref sourceEnd))
|
||||
{
|
||||
Unsafe.Add(ref destinationRef, offset) = Unsafe.Add(ref sourceRef, j);
|
||||
destinationRef = sourceStart;
|
||||
|
||||
sourceStart = ref Unsafe.Add(ref sourceStart, 1);
|
||||
destinationRef = ref Unsafe.Add(ref destinationRef, 1);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -790,12 +798,16 @@ namespace Microsoft.Toolkit.HighPerformance.Memory
|
|||
|
||||
for (int i = 0; i < height; i++)
|
||||
{
|
||||
ref T sourceRef = ref DangerousGetReferenceAt(i, 0);
|
||||
ref T sourceStart = ref DangerousGetReferenceAt(i, 0);
|
||||
ref T sourceEnd = ref Unsafe.Add(ref sourceStart, width);
|
||||
ref T destinationRef = ref destination.DangerousGetReferenceAt(i, 0);
|
||||
|
||||
for (nint j = 0; j < width; j += 1)
|
||||
while (Unsafe.IsAddressLessThan(ref sourceStart, ref sourceEnd))
|
||||
{
|
||||
Unsafe.Add(ref destinationRef, j) = Unsafe.Add(ref sourceRef, j);
|
||||
destinationRef = sourceStart;
|
||||
|
||||
sourceStart = ref Unsafe.Add(ref sourceStart, 1);
|
||||
destinationRef = ref Unsafe.Add(ref destinationRef, 1);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -866,11 +878,14 @@ namespace Microsoft.Toolkit.HighPerformance.Memory
|
|||
|
||||
for (int i = 0; i < height; i++)
|
||||
{
|
||||
ref T r0 = ref DangerousGetReferenceAt(i, 0);
|
||||
ref T rStart = ref DangerousGetReferenceAt(i, 0);
|
||||
ref T rEnd = ref Unsafe.Add(ref rStart, width);
|
||||
|
||||
for (nint j = 0; j < width; j += 1)
|
||||
while (Unsafe.IsAddressLessThan(ref rStart, ref rEnd))
|
||||
{
|
||||
Unsafe.Add(ref r0, j) = value;
|
||||
rStart = value;
|
||||
|
||||
rStart = ref Unsafe.Add(ref rStart, 1);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -1076,15 +1091,18 @@ namespace Microsoft.Toolkit.HighPerformance.Memory
|
|||
nint width = (nint)(uint)this.width;
|
||||
|
||||
ref T destinationRef = ref array.DangerousGetReference();
|
||||
nint offset = 0;
|
||||
|
||||
for (int i = 0; i < height; i++)
|
||||
{
|
||||
ref T sourceRef = ref DangerousGetReferenceAt(i, 0);
|
||||
ref T sourceStart = ref DangerousGetReferenceAt(i, 0);
|
||||
ref T sourceEnd = ref Unsafe.Add(ref sourceStart, width);
|
||||
|
||||
for (nint j = 0; j < width; j += 1, offset += 1)
|
||||
while (Unsafe.IsAddressLessThan(ref sourceStart, ref sourceEnd))
|
||||
{
|
||||
Unsafe.Add(ref destinationRef, offset) = Unsafe.Add(ref sourceRef, j);
|
||||
destinationRef = sourceStart;
|
||||
|
||||
sourceStart = ref Unsafe.Add(ref sourceStart, 1);
|
||||
destinationRef = ref Unsafe.Add(ref destinationRef, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1093,7 +1111,6 @@ namespace Microsoft.Toolkit.HighPerformance.Memory
|
|||
return array;
|
||||
}
|
||||
|
||||
#pragma warning disable CS0809 // Obsolete member overrides non-obsolete member
|
||||
/// <inheritdoc cref="Span{T}.Equals(object)"/>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
[Obsolete("Equals() on Span will always throw an exception. Use == instead.")]
|
||||
|
@ -1109,7 +1126,6 @@ namespace Microsoft.Toolkit.HighPerformance.Memory
|
|||
{
|
||||
throw new NotSupportedException("Microsoft.Toolkit.HighPerformance.Span2D<T>.GetHashCode() is not supported");
|
||||
}
|
||||
#pragma warning restore CS0809
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override string ToString()
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>netstandard1.4;netstandard2.0;netstandard2.1;netcoreapp2.1;netcoreapp3.1</TargetFrameworks>
|
||||
<TargetFrameworks>netstandard1.4;netstandard2.0;netstandard2.1;netcoreapp2.1;netcoreapp3.1;net5.0</TargetFrameworks>
|
||||
<LangVersion>9.0</LangVersion>
|
||||
<Nullable>enable</Nullable>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
|
@ -75,6 +75,11 @@
|
|||
<DefineConstants>NETSTANDARD2_1_OR_GREATER;SPAN_RUNTIME_SUPPORT</DefineConstants>
|
||||
</PropertyGroup>
|
||||
</When>
|
||||
<When Condition=" '$(TargetFramework)' == 'net5.0' ">
|
||||
<PropertyGroup>
|
||||
<DefineConstants>NETSTANDARD2_1_OR_GREATER;SPAN_RUNTIME_SUPPORT</DefineConstants>
|
||||
</PropertyGroup>
|
||||
</When>
|
||||
<When Condition=" '$(TargetFramework)' == 'netcoreapp3.1' ">
|
||||
<ItemGroup>
|
||||
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="5.0.0" />
|
||||
|
@ -82,11 +87,12 @@
|
|||
<PropertyGroup>
|
||||
|
||||
<!-- NETCORE_RUNTIME: to avoid issues with APIs that assume a specific memory layout, we define a
|
||||
.NET Core runtime constant to indicate the either .NET Core 2.1 or .NET Core 3.1. These are
|
||||
.NET Core runtime constant to indicate either .NET Core 2.1 or .NET Core 3.1. These are
|
||||
runtimes with the same overall memory layout for objects (in particular: strings, SZ arrays,
|
||||
and 2D arrays). We can use this constant to make sure that APIs that are exclusively available
|
||||
for .NET Standard targets do not make any assumption of any internals of the runtime being
|
||||
actually used by the consumers. -->
|
||||
and ND arrays). We can use this constant to make sure that APIs that are exclusively available
|
||||
for .NET Standard targets do not make any assumtpion of any internals of the runtime being
|
||||
actually used by the consumers. .NET 5.0 would fall into this category as well, but we don't
|
||||
need to include that target as it offers APIs that don't require runtime-based workarounds.-->
|
||||
<DefineConstants>NETSTANDARD2_1_OR_GREATER;SPAN_RUNTIME_SUPPORT;NETCORE_RUNTIME</DefineConstants>
|
||||
</PropertyGroup>
|
||||
</When>
|
||||
|
|
|
@ -55,7 +55,7 @@ namespace Microsoft.Toolkit.HighPerformance
|
|||
/// <summary>
|
||||
/// Gets a value indicating whether or not the current <see cref="NullableReadOnlyRef{T}"/> instance wraps a valid reference that can be accessed.
|
||||
/// </summary>
|
||||
public bool HasValue
|
||||
public unsafe bool HasValue
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get
|
||||
|
@ -63,7 +63,7 @@ namespace Microsoft.Toolkit.HighPerformance
|
|||
// See comment in NullableRef<T> about this
|
||||
byte length = unchecked((byte)this.span.Length);
|
||||
|
||||
return Unsafe.As<byte, bool>(ref length);
|
||||
return *(bool*)&length;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ namespace Microsoft.Toolkit.HighPerformance
|
|||
/// <summary>
|
||||
/// Gets a value indicating whether or not the current <see cref="NullableRef{T}"/> instance wraps a valid reference that can be accessed.
|
||||
/// </summary>
|
||||
public bool HasValue
|
||||
public unsafe bool HasValue
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get
|
||||
|
@ -67,7 +67,7 @@ namespace Microsoft.Toolkit.HighPerformance
|
|||
// This results in a single movzx instruction on x86-64.
|
||||
byte length = unchecked((byte)Span.Length);
|
||||
|
||||
return Unsafe.As<byte, bool>(ref length);
|
||||
return *(bool*)&length;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
// We can suppress the .init flag for local variables for the entire module.
|
||||
// This doesn't affect the correctness of methods in this assembly, as none of them
|
||||
// are relying on the JIT ensuring that all local memory is zeroed out to work. Doing
|
||||
// this can provide some minor performance benefits, depending on the workload.
|
||||
[module: SkipLocalsInit]
|
|
@ -1,7 +1,7 @@
|
|||
<Project Sdk="MSBuild.Sdk.Extras">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>uap10.0.17763</TargetFramework>
|
||||
<TargetFrameworks>uap10.0.17763</TargetFrameworks>
|
||||
<Title>Windows Community Toolkit Devices</Title>
|
||||
<Description>This library enables easier consumption of connectivity Devices/Peripherals and handle its connection to Windows devices. It contains BluetoothLE and Network connectivity helpers.</Description>
|
||||
<PackageTags>UWP Toolkit Windows Devices Bluetooth BluetoothLE BLE Networking</PackageTags>
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace Microsoft.Toolkit.Uwp.DeveloperTools
|
|||
/// <summary>
|
||||
/// AlignmentGrid is used to display a grid to help aligning controls
|
||||
/// </summary>
|
||||
public class AlignmentGrid : ContentControl
|
||||
public partial class AlignmentGrid : ContentControl
|
||||
{
|
||||
/// <summary>
|
||||
/// Identifies the <see cref="LineBrush"/> dependency property.
|
||||
|
|
|
@ -24,7 +24,7 @@ namespace Microsoft.Toolkit.Uwp.DeveloperTools
|
|||
[TemplatePart(Name = "ControlType", Type = typeof(TextBlock))]
|
||||
[TemplatePart(Name = "ControlAutomationName", Type = typeof(TextBlock))]
|
||||
[TemplatePart(Name = "ControlFirstParentWithName", Type = typeof(TextBlock))]
|
||||
public class FocusTracker : Control
|
||||
public partial class FocusTracker : Control
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines the <see cref="IsActive"/> dependency property.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<Project Sdk="MSBuild.Sdk.Extras">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>uap10.0.17763</TargetFramework>
|
||||
<TargetFrameworks>uap10.0.17763</TargetFrameworks>
|
||||
<Title>Windows Community Toolkit Developer Tools</Title>
|
||||
<Description>This library provides XAML user controls and services to help developers build their app. It is part of the Windows Community Toolkit.
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Windows.Devices.Input.Preview;
|
||||
using Windows.Foundation;
|
||||
|
@ -298,20 +299,9 @@ namespace Microsoft.Toolkit.Uwp.Input.GazeInteraction
|
|||
/// </summary>
|
||||
public bool IsAlwaysActivated { get; set; }
|
||||
|
||||
private static GazePointer _instance = null;
|
||||
private static ThreadLocal<GazePointer> _instance = new ThreadLocal<GazePointer>(() => new GazePointer());
|
||||
|
||||
internal static GazePointer Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_instance == null)
|
||||
{
|
||||
_instance = new GazePointer();
|
||||
}
|
||||
|
||||
return _instance;
|
||||
}
|
||||
}
|
||||
internal static GazePointer Instance => _instance.Value;
|
||||
|
||||
internal void AddRoot(int proxyId)
|
||||
{
|
||||
|
|
|
@ -15,6 +15,8 @@
|
|||
</Description>
|
||||
<PackageTags>notifications win10 windows 10 tile tiles toast toasts badge xml uwp c# csharp c++</PackageTags>
|
||||
<ExtrasImplicitPlatformPackageIsPrivate Condition=" '$(TargetFramework)' == 'native' ">true</ExtrasImplicitPlatformPackageIsPrivate>
|
||||
<DefaultTargetPlatformMinVersion>10240</DefaultTargetPlatformMinVersion>
|
||||
<TargetPlatformMinVersion>10.0.10240.0</TargetPlatformMinVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<Choose>
|
||||
|
|
|
@ -21,6 +21,8 @@ namespace Microsoft.Toolkit.Uwp.SampleApp.Controls
|
|||
public static readonly DependencyProperty TextProperty =
|
||||
DependencyProperty.Register(nameof(Text), typeof(string), typeof(XamlCodeEditor), new PropertyMetadata(string.Empty));
|
||||
|
||||
private ThemeListener _themeListener = new ThemeListener();
|
||||
|
||||
public XamlCodeEditor()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
|
@ -40,7 +42,7 @@ namespace Microsoft.Toolkit.Uwp.SampleApp.Controls
|
|||
// Highlight Error Line
|
||||
XamlCodeRenderer.Decorations.Add(new IModelDeltaDecoration(
|
||||
range,
|
||||
new IModelDecorationOptions() { IsWholeLine = true, ClassName = _errorStyle, HoverMessage = new string[] { error.Message }.ToMarkdownString() }));
|
||||
new IModelDecorationOptions() { IsWholeLine = true, ClassName = ErrorStyle, HoverMessage = new string[] { error.Message }.ToMarkdownString() }));
|
||||
|
||||
// Show Glyph Icon
|
||||
XamlCodeRenderer.Decorations.Add(new IModelDeltaDecoration(
|
||||
|
@ -121,10 +123,12 @@ namespace Microsoft.Toolkit.Uwp.SampleApp.Controls
|
|||
|
||||
public DateTime TimeSampleEditedLast { get; private set; } = DateTime.MinValue;
|
||||
|
||||
private CssLineStyle _errorStyle = new CssLineStyle()
|
||||
private CssLineStyle ErrorStyle
|
||||
{
|
||||
BackgroundColor = new SolidColorBrush(Color.FromArgb(0x00, 0xFF, 0xD6, 0xD6))
|
||||
};
|
||||
get => _themeListener.CurrentTheme.Equals(ApplicationTheme.Light) ?
|
||||
new CssLineStyle() { BackgroundColor = new SolidColorBrush(Color.FromArgb(0x00, 0xFF, 0xD6, 0xD6)) } :
|
||||
new CssLineStyle() { BackgroundColor = new SolidColorBrush(Color.FromArgb(0x00, 0x66, 0x00, 0x00)) };
|
||||
}
|
||||
|
||||
private CssGlyphStyle _errorIconStyle = new CssGlyphStyle()
|
||||
{
|
||||
|
|
|
@ -124,9 +124,6 @@
|
|||
<PackageReference Include="Microsoft.Xaml.Behaviors.Uwp.Managed">
|
||||
<Version>2.0.1</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="System.Text.Json">
|
||||
<Version>4.7.2</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="NotificationsVisualizerLibrary">
|
||||
<Version>1.0.5</Version>
|
||||
</PackageReference>
|
||||
|
@ -565,36 +562,18 @@
|
|||
<Compile Include="SamplePages\TokenizingTextBox\TokenizingTextBoxPage.xaml.cs">
|
||||
<DependentUpon>TokenizingTextBoxPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="SamplePages\Triggers\CompareStateTriggerPage.xaml.cs">
|
||||
<DependentUpon>CompareStateTriggerPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="SamplePages\Triggers\IsEqualStateTriggerPage.xaml.cs">
|
||||
<DependentUpon>IsEqualStateTriggerPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="SamplePages\Triggers\FullScreenModeStateTriggerPage.xaml.cs">
|
||||
<DependentUpon>FullScreenModeStateTriggerPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="SamplePages\Triggers\IsNullOrEmptyStateTriggerPage.xaml.cs">
|
||||
<DependentUpon>IsNullOrEmptyStateTriggerPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="SamplePages\Triggers\NetworkConnectionStateTriggerPage.xaml.cs">
|
||||
<DependentUpon>NetworkConnectionStateTriggerPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="SamplePages\Triggers\IsNotEqualStateTriggerPage.xaml.cs">
|
||||
<DependentUpon>IsNotEqualStateTriggerPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="SamplePages\Triggers\RegexStateTriggerPage.xaml.cs">
|
||||
<DependentUpon>RegexStateTriggerPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="SamplePages\Triggers\UserHandPreferenceStateTriggerPage.xaml.cs">
|
||||
<DependentUpon>UserHandPreferenceStateTriggerPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="SamplePages\Triggers\UserInteractionModeStateTriggerPage.xaml.cs">
|
||||
<DependentUpon>UserInteractionModeStateTriggerPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="SamplePages\WrapLayout\WrapLayoutPage.xaml.cs">
|
||||
<DependentUpon>WrapLayoutPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="SamplePages\XamlOnlyPage.xaml.cs">
|
||||
<DependentUpon>XamlOnlyPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Shell.Search.cs" />
|
||||
<Compile Include="Shell.SamplePicker.cs" />
|
||||
<Content Include="SamplePages\ViewportBehavior\ViewportBehaviorXaml.bind" />
|
||||
|
@ -1109,14 +1088,6 @@
|
|||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Content>
|
||||
<Page Include="SamplePages\Triggers\CompareStateTriggerPage.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="SamplePages\Triggers\IsEqualStateTriggerPage.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="SamplePages\Triggers\FullScreenModeStateTriggerPage.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
|
@ -1125,26 +1096,6 @@
|
|||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="SamplePages\Triggers\NetworkConnectionStateTriggerPage.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="SamplePages\Triggers\IsNotEqualStateTriggerPage.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="SamplePages\Triggers\RegexStateTriggerPage.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="SamplePages\Triggers\UserHandPreferenceStateTriggerPage.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="SamplePages\Triggers\UserInteractionModeStateTriggerPage.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="SamplePages\UniformGrid\UniformGridPage.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
|
@ -1473,6 +1424,10 @@
|
|||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="SamplePages\XamlOnlyPage.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Shell.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
|
|
|
@ -157,6 +157,8 @@ namespace Microsoft.Toolkit.Uwp.SampleApp
|
|||
|
||||
public string ApiCheck { get; set; }
|
||||
|
||||
public bool HasType => !string.IsNullOrWhiteSpace(Type);
|
||||
|
||||
public bool HasXAMLCode => !string.IsNullOrEmpty(XamlCodeFile);
|
||||
|
||||
public bool HasCSharpCode => !string.IsNullOrEmpty(CodeFile);
|
||||
|
|
|
@ -191,7 +191,7 @@ namespace Microsoft.Toolkit.Uwp.SampleApp
|
|||
|
||||
if (CurrentSample != null)
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(CurrentSample.Type))
|
||||
if (CurrentSample.HasType)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -219,7 +219,7 @@ namespace Microsoft.Toolkit.Uwp.SampleApp
|
|||
SamplePage.Loaded += SamplePage_Loaded;
|
||||
}
|
||||
}
|
||||
else
|
||||
else if (!CurrentSample.HasXAMLCode)
|
||||
{
|
||||
_onlyDocumentation = true;
|
||||
}
|
||||
|
@ -327,7 +327,7 @@ namespace Microsoft.Toolkit.Uwp.SampleApp
|
|||
{
|
||||
base.OnNavigatedFrom(e);
|
||||
|
||||
if (SamplePage != null)
|
||||
if (SamplePage != null && CurrentSample.HasType)
|
||||
{
|
||||
MethodInfo method = CurrentSample.PageType.GetMethod(
|
||||
"OnNavigatedFrom",
|
||||
|
@ -510,13 +510,13 @@ namespace Microsoft.Toolkit.Uwp.SampleApp
|
|||
|
||||
if (element != null)
|
||||
{
|
||||
// Add element to main panel
|
||||
if (SamplePage == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
// Add element to main panel or sub-panel
|
||||
FrameworkElement root = null;
|
||||
|
||||
var root = SamplePage.FindDescendantByName("XamlRoot");
|
||||
if (CurrentSample.HasType)
|
||||
{
|
||||
root = SamplePage?.FindDescendantByName("XamlRoot");
|
||||
}
|
||||
|
||||
if (root is Panel)
|
||||
{
|
||||
|
@ -527,7 +527,7 @@ namespace Microsoft.Toolkit.Uwp.SampleApp
|
|||
else
|
||||
{
|
||||
// Otherwise, just replace the entire page's content
|
||||
SamplePage.Content = element;
|
||||
SampleContent.Content = element;
|
||||
}
|
||||
|
||||
// Tell the page we've finished with an update to the XAML contents, after the control has rendered.
|
||||
|
|
|
@ -3,10 +3,9 @@
|
|||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Toolkit.Uwp.Helpers;
|
||||
using Microsoft.Toolkit.Uwp.Extensions;
|
||||
using Windows.System;
|
||||
using Windows.UI.Xaml;
|
||||
using Microsoft.Toolkit.Uwp.Extensions;
|
||||
|
||||
namespace Microsoft.Toolkit.Uwp.SampleApp.SamplePages
|
||||
{
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
<Page
|
||||
x:Class="Microsoft.Toolkit.Uwp.SampleApp.SamplePages.CompareStateTriggerPage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="using:Microsoft.Toolkit.Uwp.SampleApp.SamplePages"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:triggers="using:Microsoft.Toolkit.Uwp.UI.Triggers"
|
||||
mc:Ignorable="d"
|
||||
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
|
||||
<Page.Resources>
|
||||
<!-- Dummy Resource for Optimization Protection -->
|
||||
<triggers:CompareStateTrigger x:Key="CompareStateTrigger"/>
|
||||
</Page.Resources>
|
||||
</Page>
|
|
@ -1,24 +0,0 @@
|
|||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using Microsoft.Toolkit.Uwp.UI.Extensions;
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
|
||||
namespace Microsoft.Toolkit.Uwp.SampleApp.SamplePages
|
||||
{
|
||||
/// <summary>
|
||||
/// An empty page that can be used on its own or navigated to within a Frame.
|
||||
/// </summary>
|
||||
public sealed partial class CompareStateTriggerPage : Page
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="CompareStateTriggerPage"/> class.
|
||||
/// </summary>
|
||||
public CompareStateTriggerPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
<Page
|
||||
x:Class="Microsoft.Toolkit.Uwp.SampleApp.SamplePages.IsEqualStateTriggerPage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="using:Microsoft.Toolkit.Uwp.SampleApp.SamplePages"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:triggers="using:Microsoft.Toolkit.Uwp.UI.Triggers"
|
||||
mc:Ignorable="d"
|
||||
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
|
||||
<Page.Resources>
|
||||
<!-- Dummy Resource for Optimization Protection -->
|
||||
<triggers:IsEqualStateTrigger x:Key="IsEqualStateTrigger"/>
|
||||
</Page.Resources>
|
||||
</Page>
|
|
@ -1,24 +0,0 @@
|
|||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using Microsoft.Toolkit.Uwp.UI.Extensions;
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
|
||||
namespace Microsoft.Toolkit.Uwp.SampleApp.SamplePages
|
||||
{
|
||||
/// <summary>
|
||||
/// An empty page that can be used on its own or navigated to within a Frame.
|
||||
/// </summary>
|
||||
public sealed partial class IsEqualStateTriggerPage : Page
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="IsEqualStateTriggerPage"/> class.
|
||||
/// </summary>
|
||||
public IsEqualStateTriggerPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
<Page
|
||||
x:Class="Microsoft.Toolkit.Uwp.SampleApp.SamplePages.IsNotEqualStateTriggerPage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="using:Microsoft.Toolkit.Uwp.SampleApp.SamplePages"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:triggers="using:Microsoft.Toolkit.Uwp.UI.Triggers"
|
||||
mc:Ignorable="d"
|
||||
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
|
||||
<Page.Resources>
|
||||
<!-- Dummy Resource for Optimization Protection -->
|
||||
<triggers:IsNotEqualStateTrigger x:Key="IsNotEqualStateTrigger"/>
|
||||
</Page.Resources>
|
||||
</Page>
|
|
@ -1,24 +0,0 @@
|
|||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using Microsoft.Toolkit.Uwp.UI.Extensions;
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
|
||||
namespace Microsoft.Toolkit.Uwp.SampleApp.SamplePages
|
||||
{
|
||||
/// <summary>
|
||||
/// An empty page that can be used on its own or navigated to within a Frame.
|
||||
/// </summary>
|
||||
public sealed partial class IsNotEqualStateTriggerPage : Page
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="IsNotEqualStateTriggerPage"/> class.
|
||||
/// </summary>
|
||||
public IsNotEqualStateTriggerPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,15 +1,14 @@
|
|||
<Page
|
||||
x:Class="Microsoft.Toolkit.Uwp.SampleApp.SamplePages.IsNullOrEmptyStateTriggerPage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="using:Microsoft.Toolkit.Uwp.SampleApp.SamplePages"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:triggers="using:Microsoft.Toolkit.Uwp.UI.Triggers"
|
||||
mc:Ignorable="d"
|
||||
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
|
||||
<Page x:Class="Microsoft.Toolkit.Uwp.SampleApp.SamplePages.IsNullOrEmptyStateTriggerPage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="using:Microsoft.Toolkit.Uwp.SampleApp.SamplePages"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:triggers="using:Microsoft.Toolkit.Uwp.UI.Triggers"
|
||||
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"
|
||||
mc:Ignorable="d">
|
||||
<Page.Resources>
|
||||
<!-- Dummy Resource for Optimization Protection -->
|
||||
<triggers:IsNullOrEmptyStateTrigger x:Key="IsNullOrEmptyStateTrigger"/>
|
||||
<!-- Dummy Resource for Optimization Protection -->
|
||||
<triggers:IsNullOrEmptyStateTrigger x:Key="IsNullOrEmptyStateTrigger" />
|
||||
</Page.Resources>
|
||||
</Page>
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
<Page
|
||||
x:Class="Microsoft.Toolkit.Uwp.SampleApp.SamplePages.NetworkConnectionStateTriggerPage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="using:Microsoft.Toolkit.Uwp.SampleApp.SamplePages"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:triggers="using:Microsoft.Toolkit.Uwp.UI.Triggers"
|
||||
mc:Ignorable="d"
|
||||
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
|
||||
<Page.Resources>
|
||||
<!-- Dummy Resource for Optimization Protection -->
|
||||
<triggers:NetworkConnectionStateTrigger x:Key="NetworkConnectionStateTrigger"/>
|
||||
</Page.Resources>
|
||||
</Page>
|
|
@ -1,24 +0,0 @@
|
|||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using Microsoft.Toolkit.Uwp.UI.Extensions;
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
|
||||
namespace Microsoft.Toolkit.Uwp.SampleApp.SamplePages
|
||||
{
|
||||
/// <summary>
|
||||
/// An empty page that can be used on its own or navigated to within a Frame.
|
||||
/// </summary>
|
||||
public sealed partial class NetworkConnectionStateTriggerPage : Page
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="NetworkConnectionStateTriggerPage"/> class.
|
||||
/// </summary>
|
||||
public NetworkConnectionStateTriggerPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
<Page
|
||||
x:Class="Microsoft.Toolkit.Uwp.SampleApp.SamplePages.RegexStateTriggerPage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="using:Microsoft.Toolkit.Uwp.SampleApp.SamplePages"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:triggers="using:Microsoft.Toolkit.Uwp.UI.Triggers"
|
||||
mc:Ignorable="d"
|
||||
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
|
||||
<Page.Resources>
|
||||
<!-- Dummy Resource for Optimization Protection -->
|
||||
<triggers:RegexStateTrigger x:Key="RegexStateTrigger"/>
|
||||
</Page.Resources>
|
||||
</Page>
|
|
@ -1,15 +0,0 @@
|
|||
<Page
|
||||
x:Class="Microsoft.Toolkit.Uwp.SampleApp.SamplePages.UserHandPreferenceStateTriggerPage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="using:Microsoft.Toolkit.Uwp.SampleApp.SamplePages"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:triggers="using:Microsoft.Toolkit.Uwp.UI.Triggers"
|
||||
mc:Ignorable="d"
|
||||
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
|
||||
<Page.Resources>
|
||||
<!-- Dummy Resource for Optimization Protection -->
|
||||
<triggers:UserHandPreferenceStateTrigger x:Key="UserHandPreferenceStateTrigger"/>
|
||||
</Page.Resources>
|
||||
</Page>
|
|
@ -1,24 +0,0 @@
|
|||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using Microsoft.Toolkit.Uwp.UI.Extensions;
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
|
||||
namespace Microsoft.Toolkit.Uwp.SampleApp.SamplePages
|
||||
{
|
||||
/// <summary>
|
||||
/// An empty page that can be used on its own or navigated to within a Frame.
|
||||
/// </summary>
|
||||
public sealed partial class UserHandPreferenceStateTriggerPage : Page
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="UserHandPreferenceStateTriggerPage"/> class.
|
||||
/// </summary>
|
||||
public UserHandPreferenceStateTriggerPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
<Page
|
||||
x:Class="Microsoft.Toolkit.Uwp.SampleApp.SamplePages.UserInteractionModeStateTriggerPage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="using:Microsoft.Toolkit.Uwp.SampleApp.SamplePages"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:triggers="using:Microsoft.Toolkit.Uwp.UI.Triggers"
|
||||
mc:Ignorable="d"
|
||||
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
|
||||
<Page.Resources>
|
||||
<!-- Dummy Resource for Optimization Protection -->
|
||||
<triggers:UserInteractionModeStateTrigger x:Key="UserInteractionModeStateTrigger"/>
|
||||
</Page.Resources>
|
||||
</Page>
|
|
@ -1,24 +0,0 @@
|
|||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using Microsoft.Toolkit.Uwp.UI.Extensions;
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
|
||||
namespace Microsoft.Toolkit.Uwp.SampleApp.SamplePages
|
||||
{
|
||||
/// <summary>
|
||||
/// An empty page that can be used on its own or navigated to within a Frame.
|
||||
/// </summary>
|
||||
public sealed partial class UserInteractionModeStateTriggerPage : Page
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="UserInteractionModeStateTriggerPage"/> class.
|
||||
/// </summary>
|
||||
public UserInteractionModeStateTriggerPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
<Page x:Class="Microsoft.Toolkit.Uwp.SampleApp.SamplePages.XamlOnlyPage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="using:Microsoft.Toolkit.Uwp.SampleApp.SamplePages"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:triggers="using:Microsoft.Toolkit.Uwp.UI.Triggers"
|
||||
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<!-- Dummy Page for .NET Native Optimization Protection -->
|
||||
<!-- Put a copy of any controls/resources required for XAML Parsing within XAML Only Samples -->
|
||||
<!-- This page is never loaded by the app, but used to trick the compiler... -->
|
||||
<Page.Resources>
|
||||
<triggers:CompareStateTrigger x:Key="CompareStateTrigger" />
|
||||
<triggers:IsEqualStateTrigger x:Key="IsEqualStateTrigger" />
|
||||
<triggers:IsNotEqualStateTrigger x:Key="IsNotEqualStateTrigger" />
|
||||
<triggers:NetworkConnectionStateTrigger x:Key="NetworkConnectionStateTrigger" />
|
||||
<triggers:RegexStateTrigger x:Key="RegexStateTrigger" />
|
||||
<triggers:UserHandPreferenceStateTrigger x:Key="UserHandPreferenceStateTrigger" />
|
||||
<triggers:UserInteractionModeStateTrigger x:Key="UserInteractionModeStateTrigger" />
|
||||
</Page.Resources>
|
||||
|
||||
<Grid />
|
||||
</Page>
|
|
@ -2,8 +2,6 @@
|
|||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using Microsoft.Toolkit.Uwp.UI.Extensions;
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
|
||||
namespace Microsoft.Toolkit.Uwp.SampleApp.SamplePages
|
||||
|
@ -11,14 +9,12 @@ namespace Microsoft.Toolkit.Uwp.SampleApp.SamplePages
|
|||
/// <summary>
|
||||
/// An empty page that can be used on its own or navigated to within a Frame.
|
||||
/// </summary>
|
||||
public sealed partial class RegexStateTriggerPage : Page
|
||||
public sealed partial class XamlOnlyPage : Page
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="RegexStateTriggerPage"/> class.
|
||||
/// </summary>
|
||||
public RegexStateTriggerPage()
|
||||
public XamlOnlyPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
// DO NOT add any code here, this page is never loaded...
|
||||
this.InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -941,7 +941,6 @@
|
|||
},
|
||||
{
|
||||
"Name": "CompareStateTrigger",
|
||||
"Type": "CompareStateTriggerPage",
|
||||
"Subcategory": "State Triggers",
|
||||
"About": "Enables a state if the value is equal to, greater than, or less than another value",
|
||||
"CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Triggers",
|
||||
|
@ -951,7 +950,6 @@
|
|||
},
|
||||
{
|
||||
"Name": "IsEqualStateTrigger",
|
||||
"Type": "IsEqualStateTriggerPage",
|
||||
"Subcategory": "State Triggers",
|
||||
"About": "Enables a state if the value is equal to another value",
|
||||
"CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Triggers",
|
||||
|
@ -981,7 +979,6 @@
|
|||
},
|
||||
{
|
||||
"Name": "NetworkConnectionStateTrigger",
|
||||
"Type": "NetworkConnectionStateTriggerPage",
|
||||
"Subcategory": "State Triggers",
|
||||
"About": "Trigger for switching when the network availability changes",
|
||||
"CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Triggers",
|
||||
|
@ -991,7 +988,6 @@
|
|||
},
|
||||
{
|
||||
"Name": "IsNotEqualStateTrigger",
|
||||
"Type": "IsNotEqualStateTriggerPage",
|
||||
"Subcategory": "State Triggers",
|
||||
"About": "Enables a state if the value is not equal to another value",
|
||||
"CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Triggers",
|
||||
|
@ -1001,7 +997,6 @@
|
|||
},
|
||||
{
|
||||
"Name": "RegexStateTrigger",
|
||||
"Type": "RegexStateTriggerPage",
|
||||
"Subcategory": "State Triggers",
|
||||
"About": "Enables a state if the regex expression is true for a given string value",
|
||||
"CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Triggers",
|
||||
|
@ -1011,7 +1006,6 @@
|
|||
},
|
||||
{
|
||||
"Name": "UserHandPreferenceStateTrigger",
|
||||
"Type": "UserHandPreferenceStateTriggerPage",
|
||||
"Subcategory": "State Triggers",
|
||||
"About": "Trigger for switching UI based on whether the user favours their left or right hand.",
|
||||
"CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Triggers",
|
||||
|
@ -1021,7 +1015,6 @@
|
|||
},
|
||||
{
|
||||
"Name": "UserInteractionModeStateTrigger",
|
||||
"Type": "UserInteractionModeStateTriggerPage",
|
||||
"Subcategory": "State Triggers",
|
||||
"About": "Trigger for switching when the User interaction mode changes (tablet mode)",
|
||||
"CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Triggers",
|
||||
|
|
|
@ -7,6 +7,7 @@ using System.Collections.Generic;
|
|||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Toolkit.Uwp.Extensions;
|
||||
using Microsoft.Toolkit.Uwp.Helpers;
|
||||
using Microsoft.Toolkit.Uwp.SampleApp.Pages;
|
||||
using Microsoft.Toolkit.Uwp.UI.Animations;
|
||||
|
@ -147,7 +148,7 @@ namespace Microsoft.Toolkit.Uwp.SampleApp
|
|||
ShowSamplePicker(category.Samples, true);
|
||||
|
||||
// Then Focus on Picker
|
||||
DispatcherHelper.ExecuteOnUIThreadAsync(() => SamplePickerGridView.Focus(FocusState.Keyboard));
|
||||
dispatcherQueue.EnqueueAsync(() => SamplePickerGridView.Focus(FocusState.Keyboard));
|
||||
}
|
||||
}
|
||||
else if (args.IsSettingsInvoked)
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System.Linq;
|
||||
using Microsoft.Toolkit.Uwp.Extensions;
|
||||
using Microsoft.Toolkit.Uwp.Helpers;
|
||||
using Microsoft.Toolkit.Uwp.UI.Extensions;
|
||||
using Windows.UI.Xaml;
|
||||
|
@ -76,7 +77,7 @@ namespace Microsoft.Toolkit.Uwp.SampleApp
|
|||
if (e.Key == Windows.System.VirtualKey.Down && SamplePickerGrid.Visibility == Windows.UI.Xaml.Visibility.Visible)
|
||||
{
|
||||
// If we try and navigate down out of the textbox (and there's search results), go to the search results.
|
||||
DispatcherHelper.ExecuteOnUIThreadAsync(() => SamplePickerGridView.Focus(FocusState.Keyboard));
|
||||
dispatcherQueue.EnqueueAsync(() => SamplePickerGridView.Focus(FocusState.Keyboard));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,6 @@ using Microsoft.Toolkit.Uwp.Helpers;
|
|||
using Microsoft.Toolkit.Uwp.SampleApp.Pages;
|
||||
using Microsoft.Toolkit.Uwp.UI.Extensions;
|
||||
using Windows.System;
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
using Windows.UI.Xaml.Media.Animation;
|
||||
using Windows.UI.Xaml.Navigation;
|
||||
|
@ -16,6 +15,8 @@ namespace Microsoft.Toolkit.Uwp.SampleApp
|
|||
{
|
||||
public sealed partial class Shell
|
||||
{
|
||||
private readonly DispatcherQueue dispatcherQueue = DispatcherQueue.GetForCurrentThread();
|
||||
|
||||
public static Shell Current { get; private set; }
|
||||
|
||||
public Shell()
|
||||
|
|
|
@ -11,6 +11,7 @@ using Windows.UI.Xaml;
|
|||
using Windows.UI.Xaml.Controls;
|
||||
using Windows.UI.Xaml.Hosting;
|
||||
using Windows.UI.Xaml.Input;
|
||||
using Windows.UI.Xaml.Media;
|
||||
|
||||
namespace Microsoft.Toolkit.Uwp.UI.Animations.Behaviors
|
||||
{
|
||||
|
@ -238,7 +239,9 @@ namespace Microsoft.Toolkit.Uwp.UI.Animations.Behaviors
|
|||
focusedElement = FocusManager.GetFocusedElement();
|
||||
}
|
||||
|
||||
if (focusedElement is UIElement element)
|
||||
// To prevent Popups (Flyouts...) from triggering the autoscroll, we check if the focused element has a valid parent.
|
||||
// Popups have no parents, whereas a normal Item would have the ListView as a parent.
|
||||
if (focusedElement is UIElement element && VisualTreeHelper.GetParent(element) != null)
|
||||
{
|
||||
FrameworkElement header = (FrameworkElement)HeaderElement;
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Animations
|
|||
/// Abstract class providing common dependency properties for composition animations
|
||||
/// </summary>
|
||||
[ContentProperty(Name = nameof(KeyFrames))]
|
||||
public abstract class AnimationBase : DependencyObject
|
||||
public abstract partial class AnimationBase : DependencyObject
|
||||
{
|
||||
/// <summary>
|
||||
/// Identifies the <see cref="Target"/> property
|
||||
|
|
|
@ -9,7 +9,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Animations
|
|||
/// <summary>
|
||||
/// Provides common Dependency properties for KeyFrames
|
||||
/// </summary>
|
||||
public abstract class KeyFrame : DependencyObject
|
||||
public abstract partial class KeyFrame : DependencyObject
|
||||
{
|
||||
/// <summary>
|
||||
/// Identifies the <see cref="Key"/> dependency property
|
||||
|
|
|
@ -221,6 +221,26 @@ namespace Microsoft.Toolkit.Uwp.UI.Animations.Expressions
|
|||
modifier.Motion = CreateExpressionAnimationFromNode(modifier.Compositor, expressionNode);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Use the value of specified ExpressionNode to determine if this composition conditional value modifier should be chosen.
|
||||
/// </summary>
|
||||
/// <param name="modifier">The modifier.</param>
|
||||
/// <param name="expressionNode">The root ExpressionNode that represents the ExpressionAnimation.</param>
|
||||
public static void SetCondition(this CompositionConditionalValue modifier, ExpressionNode expressionNode)
|
||||
{
|
||||
modifier.Condition = CreateExpressionAnimationFromNode(modifier.Compositor, expressionNode);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Use the value of specified ExpressionNode as the value for this composition conditional value
|
||||
/// </summary>
|
||||
/// <param name="modifier">The modifier.</param>
|
||||
/// <param name="expressionNode">The root ExpressionNode that represents the ExpressionAnimation.</param>
|
||||
public static void SetValue(this CompositionConditionalValue modifier, ExpressionNode expressionNode)
|
||||
{
|
||||
modifier.Value = CreateExpressionAnimationFromNode(modifier.Compositor, expressionNode);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates the expression animation from node.
|
||||
/// </summary>
|
||||
|
|
|
@ -1253,80 +1253,80 @@ namespace Microsoft.Toolkit.Uwp.UI.Animations.Expressions
|
|||
/// </summary>
|
||||
private static readonly Dictionary<ExpressionNodeType, ExpressionNodeInfo> _expressionNodeInfo = new Dictionary<ExpressionNodeType, ExpressionNodeInfo>
|
||||
{
|
||||
{ ExpressionNodeType.ConstantValue, new ExpressionNodeInfo(OperationType.Constant, null) },
|
||||
{ ExpressionNodeType.ConstantParameter, new ExpressionNodeInfo(OperationType.Constant, null) },
|
||||
{ ExpressionNodeType.CurrentValueProperty, new ExpressionNodeInfo(OperationType.Reference, null) },
|
||||
{ ExpressionNodeType.Reference, new ExpressionNodeInfo(OperationType.Reference, null) },
|
||||
{ ExpressionNodeType.ReferenceProperty, new ExpressionNodeInfo(OperationType.Reference, null) },
|
||||
{ ExpressionNodeType.StartingValueProperty, new ExpressionNodeInfo(OperationType.Reference, null) },
|
||||
{ ExpressionNodeType.TargetReference, new ExpressionNodeInfo(OperationType.Reference, null) },
|
||||
{ ExpressionNodeType.Conditional, new ExpressionNodeInfo(OperationType.Conditional, null) },
|
||||
{ ExpressionNodeType.Swizzle, new ExpressionNodeInfo(OperationType.Swizzle, null) },
|
||||
{ ExpressionNodeType.Add, new ExpressionNodeInfo(OperationType.Operator, "+") },
|
||||
{ ExpressionNodeType.And, new ExpressionNodeInfo(OperationType.Operator, "&&") },
|
||||
{ ExpressionNodeType.Divide, new ExpressionNodeInfo(OperationType.Operator, "/") },
|
||||
{ ExpressionNodeType.Equals, new ExpressionNodeInfo(OperationType.Operator, "==") },
|
||||
{ ExpressionNodeType.GreaterThan, new ExpressionNodeInfo(OperationType.Operator, ">") },
|
||||
{ ExpressionNodeType.GreaterThanEquals, new ExpressionNodeInfo(OperationType.Operator, ">=") },
|
||||
{ ExpressionNodeType.LessThan, new ExpressionNodeInfo(OperationType.Operator, "<") },
|
||||
{ ExpressionNodeType.LessThanEquals, new ExpressionNodeInfo(OperationType.Operator, "<=") },
|
||||
{ ExpressionNodeType.Multiply, new ExpressionNodeInfo(OperationType.Operator, "*") },
|
||||
{ ExpressionNodeType.Not, new ExpressionNodeInfo(OperationType.Operator, "!") },
|
||||
{ ExpressionNodeType.NotEquals, new ExpressionNodeInfo(OperationType.Operator, "!=") },
|
||||
{ ExpressionNodeType.Or, new ExpressionNodeInfo(OperationType.Operator, "||") },
|
||||
{ ExpressionNodeType.Subtract, new ExpressionNodeInfo(OperationType.Operator, "-") },
|
||||
{ ExpressionNodeType.Absolute, new ExpressionNodeInfo(OperationType.Function, "abs") },
|
||||
{ ExpressionNodeType.Acos, new ExpressionNodeInfo(OperationType.Function, "acos") },
|
||||
{ ExpressionNodeType.Asin, new ExpressionNodeInfo(OperationType.Function, "asin") },
|
||||
{ ExpressionNodeType.Atan, new ExpressionNodeInfo(OperationType.Function, "atan") },
|
||||
{ ExpressionNodeType.Cos, new ExpressionNodeInfo(OperationType.Function, "cos") },
|
||||
{ ExpressionNodeType.Ceil, new ExpressionNodeInfo(OperationType.Function, "ceil") },
|
||||
{ ExpressionNodeType.Clamp, new ExpressionNodeInfo(OperationType.Function, "clamp") },
|
||||
{ ExpressionNodeType.ColorHsl, new ExpressionNodeInfo(OperationType.Function, "colorhsl") },
|
||||
{ ExpressionNodeType.ColorRgb, new ExpressionNodeInfo(OperationType.Function, "colorrgb") },
|
||||
{ ExpressionNodeType.ColorLerp, new ExpressionNodeInfo(OperationType.Function, "colorlerp") },
|
||||
{ ExpressionNodeType.ColorLerpHsl, new ExpressionNodeInfo(OperationType.Function, "colorhsllerp") },
|
||||
{ ExpressionNodeType.ColorLerpRgb, new ExpressionNodeInfo(OperationType.Function, "colorrgblerp") },
|
||||
{ ExpressionNodeType.Concatenate, new ExpressionNodeInfo(OperationType.Function, "concatenate") },
|
||||
{ ExpressionNodeType.Distance, new ExpressionNodeInfo(OperationType.Function, "distance") },
|
||||
{ ExpressionNodeType.DistanceSquared, new ExpressionNodeInfo(OperationType.Function, "distancesquared") },
|
||||
{ ExpressionNodeType.Floor, new ExpressionNodeInfo(OperationType.Function, "floor") },
|
||||
{ ExpressionNodeType.Inverse, new ExpressionNodeInfo(OperationType.Function, "inverse") },
|
||||
{ ExpressionNodeType.Length, new ExpressionNodeInfo(OperationType.Function, "length") },
|
||||
{ ExpressionNodeType.LengthSquared, new ExpressionNodeInfo(OperationType.Function, "lengthsquared") },
|
||||
{ ExpressionNodeType.Lerp, new ExpressionNodeInfo(OperationType.Function, "lerp") },
|
||||
{ ExpressionNodeType.Ln, new ExpressionNodeInfo(OperationType.Function, "ln") },
|
||||
{ ExpressionNodeType.Log10, new ExpressionNodeInfo(OperationType.Function, "log10") },
|
||||
{ ExpressionNodeType.Max, new ExpressionNodeInfo(OperationType.Function, "max") },
|
||||
{ ExpressionNodeType.Matrix3x2FromRotation, new ExpressionNodeInfo(OperationType.Function, "matrix3x2.createrotation") },
|
||||
{ ExpressionNodeType.Matrix3x2FromScale, new ExpressionNodeInfo(OperationType.Function, "matrix3x2.createscale") },
|
||||
{ ExpressionNodeType.Matrix3x2FromSkew, new ExpressionNodeInfo(OperationType.Function, "matrix3x2.createskew") },
|
||||
{ ExpressionNodeType.Matrix3x2FromTranslation, new ExpressionNodeInfo(OperationType.Function, "matrix3x2.createtranslation") },
|
||||
{ ExpressionNodeType.Matrix3x2, new ExpressionNodeInfo(OperationType.Function, "matrix3x2") },
|
||||
{ ExpressionNodeType.Matrix4x4FromAxisAngle, new ExpressionNodeInfo(OperationType.Function, "matrix4x4.createfromaxisangle") },
|
||||
{ ExpressionNodeType.Matrix4x4FromScale, new ExpressionNodeInfo(OperationType.Function, "matrix4x4.createscale") },
|
||||
{ ExpressionNodeType.Matrix4x4FromTranslation, new ExpressionNodeInfo(OperationType.Function, "matrix4x4.createtranslation") },
|
||||
{ ExpressionNodeType.Matrix4x4, new ExpressionNodeInfo(OperationType.Function, "matrix4x4") },
|
||||
{ ExpressionNodeType.Min, new ExpressionNodeInfo(OperationType.Function, "min") },
|
||||
{ ExpressionNodeType.Modulus, new ExpressionNodeInfo(OperationType.Function, "mod") },
|
||||
{ ExpressionNodeType.Negate, new ExpressionNodeInfo(OperationType.Function, "-") },
|
||||
{ ExpressionNodeType.Normalize, new ExpressionNodeInfo(OperationType.Function, "normalize") },
|
||||
{ ExpressionNodeType.Pow, new ExpressionNodeInfo(OperationType.Function, "pow") },
|
||||
{ ExpressionNodeType.QuaternionFromAxisAngle, new ExpressionNodeInfo(OperationType.Function, "quaternion.createfromaxisangle") },
|
||||
{ ExpressionNodeType.Quaternion, new ExpressionNodeInfo(OperationType.Function, "quaternion") },
|
||||
{ ExpressionNodeType.Round, new ExpressionNodeInfo(OperationType.Function, "round") },
|
||||
{ ExpressionNodeType.Scale, new ExpressionNodeInfo(OperationType.Function, "scale") },
|
||||
{ ExpressionNodeType.Sin, new ExpressionNodeInfo(OperationType.Function, "sin") },
|
||||
{ ExpressionNodeType.Slerp, new ExpressionNodeInfo(OperationType.Function, "slerp") },
|
||||
{ ExpressionNodeType.Sqrt, new ExpressionNodeInfo(OperationType.Function, "sqrt") },
|
||||
{ ExpressionNodeType.Square, new ExpressionNodeInfo(OperationType.Function, "square") },
|
||||
{ ExpressionNodeType.Tan, new ExpressionNodeInfo(OperationType.Function, "tan") },
|
||||
{ ExpressionNodeType.ToDegrees, new ExpressionNodeInfo(OperationType.Function, "todegrees") },
|
||||
{ ExpressionNodeType.ToRadians, new ExpressionNodeInfo(OperationType.Function, "toradians") },
|
||||
{ ExpressionNodeType.Transform, new ExpressionNodeInfo(OperationType.Function, "transform") },
|
||||
{ ExpressionNodeType.Vector2, new ExpressionNodeInfo(OperationType.Function, "vector2") },
|
||||
{ ExpressionNodeType.Vector3, new ExpressionNodeInfo(OperationType.Function, "vector3") },
|
||||
{ ExpressionNodeType.Vector4, new ExpressionNodeInfo(OperationType.Function, "vector4") },
|
||||
{ ExpressionNodeType.ConstantValue, new ExpressionNodeInfo(OperationType.Constant, null) },
|
||||
{ ExpressionNodeType.ConstantParameter, new ExpressionNodeInfo(OperationType.Constant, null) },
|
||||
{ ExpressionNodeType.CurrentValueProperty, new ExpressionNodeInfo(OperationType.Reference, null) },
|
||||
{ ExpressionNodeType.Reference, new ExpressionNodeInfo(OperationType.Reference, null) },
|
||||
{ ExpressionNodeType.ReferenceProperty, new ExpressionNodeInfo(OperationType.Reference, null) },
|
||||
{ ExpressionNodeType.StartingValueProperty, new ExpressionNodeInfo(OperationType.Reference, null) },
|
||||
{ ExpressionNodeType.TargetReference, new ExpressionNodeInfo(OperationType.Reference, null) },
|
||||
{ ExpressionNodeType.Conditional, new ExpressionNodeInfo(OperationType.Conditional, null) },
|
||||
{ ExpressionNodeType.Swizzle, new ExpressionNodeInfo(OperationType.Swizzle, null) },
|
||||
{ ExpressionNodeType.Add, new ExpressionNodeInfo(OperationType.Operator, "+") },
|
||||
{ ExpressionNodeType.And, new ExpressionNodeInfo(OperationType.Operator, "&&") },
|
||||
{ ExpressionNodeType.Divide, new ExpressionNodeInfo(OperationType.Operator, "/") },
|
||||
{ ExpressionNodeType.Equals, new ExpressionNodeInfo(OperationType.Operator, "==") },
|
||||
{ ExpressionNodeType.GreaterThan, new ExpressionNodeInfo(OperationType.Operator, ">") },
|
||||
{ ExpressionNodeType.GreaterThanEquals, new ExpressionNodeInfo(OperationType.Operator, ">=") },
|
||||
{ ExpressionNodeType.LessThan, new ExpressionNodeInfo(OperationType.Operator, "<") },
|
||||
{ ExpressionNodeType.LessThanEquals, new ExpressionNodeInfo(OperationType.Operator, "<=") },
|
||||
{ ExpressionNodeType.Multiply, new ExpressionNodeInfo(OperationType.Operator, "*") },
|
||||
{ ExpressionNodeType.Not, new ExpressionNodeInfo(OperationType.UnaryOperator, "!") },
|
||||
{ ExpressionNodeType.NotEquals, new ExpressionNodeInfo(OperationType.Operator, "!=") },
|
||||
{ ExpressionNodeType.Or, new ExpressionNodeInfo(OperationType.Operator, "||") },
|
||||
{ ExpressionNodeType.Subtract, new ExpressionNodeInfo(OperationType.Operator, "-") },
|
||||
{ ExpressionNodeType.Absolute, new ExpressionNodeInfo(OperationType.Function, "abs") },
|
||||
{ ExpressionNodeType.Acos, new ExpressionNodeInfo(OperationType.Function, "acos") },
|
||||
{ ExpressionNodeType.Asin, new ExpressionNodeInfo(OperationType.Function, "asin") },
|
||||
{ ExpressionNodeType.Atan, new ExpressionNodeInfo(OperationType.Function, "atan") },
|
||||
{ ExpressionNodeType.Cos, new ExpressionNodeInfo(OperationType.Function, "cos") },
|
||||
{ ExpressionNodeType.Ceil, new ExpressionNodeInfo(OperationType.Function, "ceil") },
|
||||
{ ExpressionNodeType.Clamp, new ExpressionNodeInfo(OperationType.Function, "clamp") },
|
||||
{ ExpressionNodeType.ColorHsl, new ExpressionNodeInfo(OperationType.Function, "colorhsl") },
|
||||
{ ExpressionNodeType.ColorRgb, new ExpressionNodeInfo(OperationType.Function, "colorrgb") },
|
||||
{ ExpressionNodeType.ColorLerp, new ExpressionNodeInfo(OperationType.Function, "colorlerp") },
|
||||
{ ExpressionNodeType.ColorLerpHsl, new ExpressionNodeInfo(OperationType.Function, "colorhsllerp") },
|
||||
{ ExpressionNodeType.ColorLerpRgb, new ExpressionNodeInfo(OperationType.Function, "colorrgblerp") },
|
||||
{ ExpressionNodeType.Concatenate, new ExpressionNodeInfo(OperationType.Function, "concatenate") },
|
||||
{ ExpressionNodeType.Distance, new ExpressionNodeInfo(OperationType.Function, "distance") },
|
||||
{ ExpressionNodeType.DistanceSquared, new ExpressionNodeInfo(OperationType.Function, "distancesquared") },
|
||||
{ ExpressionNodeType.Floor, new ExpressionNodeInfo(OperationType.Function, "floor") },
|
||||
{ ExpressionNodeType.Inverse, new ExpressionNodeInfo(OperationType.Function, "inverse") },
|
||||
{ ExpressionNodeType.Length, new ExpressionNodeInfo(OperationType.Function, "length") },
|
||||
{ ExpressionNodeType.LengthSquared, new ExpressionNodeInfo(OperationType.Function, "lengthsquared") },
|
||||
{ ExpressionNodeType.Lerp, new ExpressionNodeInfo(OperationType.Function, "lerp") },
|
||||
{ ExpressionNodeType.Ln, new ExpressionNodeInfo(OperationType.Function, "ln") },
|
||||
{ ExpressionNodeType.Log10, new ExpressionNodeInfo(OperationType.Function, "log10") },
|
||||
{ ExpressionNodeType.Max, new ExpressionNodeInfo(OperationType.Function, "max") },
|
||||
{ ExpressionNodeType.Matrix3x2FromRotation, new ExpressionNodeInfo(OperationType.Function, "matrix3x2.createrotation") },
|
||||
{ ExpressionNodeType.Matrix3x2FromScale, new ExpressionNodeInfo(OperationType.Function, "matrix3x2.createscale") },
|
||||
{ ExpressionNodeType.Matrix3x2FromSkew, new ExpressionNodeInfo(OperationType.Function, "matrix3x2.createskew") },
|
||||
{ ExpressionNodeType.Matrix3x2FromTranslation, new ExpressionNodeInfo(OperationType.Function, "matrix3x2.createtranslation") },
|
||||
{ ExpressionNodeType.Matrix3x2, new ExpressionNodeInfo(OperationType.Function, "matrix3x2") },
|
||||
{ ExpressionNodeType.Matrix4x4FromAxisAngle, new ExpressionNodeInfo(OperationType.Function, "matrix4x4.createfromaxisangle") },
|
||||
{ ExpressionNodeType.Matrix4x4FromScale, new ExpressionNodeInfo(OperationType.Function, "matrix4x4.createscale") },
|
||||
{ ExpressionNodeType.Matrix4x4FromTranslation, new ExpressionNodeInfo(OperationType.Function, "matrix4x4.createtranslation") },
|
||||
{ ExpressionNodeType.Matrix4x4, new ExpressionNodeInfo(OperationType.Function, "matrix4x4") },
|
||||
{ ExpressionNodeType.Min, new ExpressionNodeInfo(OperationType.Function, "min") },
|
||||
{ ExpressionNodeType.Modulus, new ExpressionNodeInfo(OperationType.Function, "mod") },
|
||||
{ ExpressionNodeType.Negate, new ExpressionNodeInfo(OperationType.Function, "-") },
|
||||
{ ExpressionNodeType.Normalize, new ExpressionNodeInfo(OperationType.Function, "normalize") },
|
||||
{ ExpressionNodeType.Pow, new ExpressionNodeInfo(OperationType.Function, "pow") },
|
||||
{ ExpressionNodeType.QuaternionFromAxisAngle, new ExpressionNodeInfo(OperationType.Function, "quaternion.createfromaxisangle") },
|
||||
{ ExpressionNodeType.Quaternion, new ExpressionNodeInfo(OperationType.Function, "quaternion") },
|
||||
{ ExpressionNodeType.Round, new ExpressionNodeInfo(OperationType.Function, "round") },
|
||||
{ ExpressionNodeType.Scale, new ExpressionNodeInfo(OperationType.Function, "scale") },
|
||||
{ ExpressionNodeType.Sin, new ExpressionNodeInfo(OperationType.Function, "sin") },
|
||||
{ ExpressionNodeType.Slerp, new ExpressionNodeInfo(OperationType.Function, "slerp") },
|
||||
{ ExpressionNodeType.Sqrt, new ExpressionNodeInfo(OperationType.Function, "sqrt") },
|
||||
{ ExpressionNodeType.Square, new ExpressionNodeInfo(OperationType.Function, "square") },
|
||||
{ ExpressionNodeType.Tan, new ExpressionNodeInfo(OperationType.Function, "tan") },
|
||||
{ ExpressionNodeType.ToDegrees, new ExpressionNodeInfo(OperationType.Function, "todegrees") },
|
||||
{ ExpressionNodeType.ToRadians, new ExpressionNodeInfo(OperationType.Function, "toradians") },
|
||||
{ ExpressionNodeType.Transform, new ExpressionNodeInfo(OperationType.Function, "transform") },
|
||||
{ ExpressionNodeType.Vector2, new ExpressionNodeInfo(OperationType.Function, "vector2") },
|
||||
{ ExpressionNodeType.Vector3, new ExpressionNodeInfo(OperationType.Function, "vector3") },
|
||||
{ ExpressionNodeType.Vector4, new ExpressionNodeInfo(OperationType.Function, "vector4") },
|
||||
};
|
||||
}
|
||||
}
|
|
@ -502,6 +502,15 @@ namespace Microsoft.Toolkit.Uwp.UI.Animations.Expressions
|
|||
ret = $"({Children[0].ToExpressionStringInternal()} {GetOperationString()} {Children[1].ToExpressionStringInternal()})";
|
||||
break;
|
||||
|
||||
case OperationType.UnaryOperator:
|
||||
if (Children.Count != 1)
|
||||
{
|
||||
throw new Exception("Can't have an unary operator that doesn't have exactly one params");
|
||||
}
|
||||
|
||||
ret = $"( {GetOperationString()} {Children[0].ToExpressionStringInternal()} )";
|
||||
break;
|
||||
|
||||
case OperationType.Constant:
|
||||
if (Children.Count == 0)
|
||||
{
|
||||
|
|
|
@ -15,10 +15,15 @@ namespace Microsoft.Toolkit.Uwp.UI.Animations.Expressions
|
|||
Function,
|
||||
|
||||
/// <summary>
|
||||
/// The operator
|
||||
/// The operator (takes two operands)
|
||||
/// </summary>
|
||||
Operator,
|
||||
|
||||
/// <summary>
|
||||
/// The operator that only takes one operand
|
||||
/// </summary>
|
||||
UnaryOperator,
|
||||
|
||||
/// <summary>
|
||||
/// The constant
|
||||
/// </summary>
|
||||
|
|
|
@ -6,7 +6,7 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using Microsoft.Graphics.Canvas;
|
||||
using Microsoft.Graphics.Canvas.Effects;
|
||||
using Microsoft.Toolkit.Uwp.Helpers;
|
||||
using Microsoft.Toolkit.Uwp.Extensions;
|
||||
using Windows.UI;
|
||||
using Windows.UI.Composition;
|
||||
using Windows.UI.Composition.Effects;
|
||||
|
@ -102,7 +102,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Animations
|
|||
var task = new AnimationTask();
|
||||
task.AnimationSet = animationSet;
|
||||
|
||||
task.Task = DispatcherHelper.ExecuteOnUIThreadAsync(
|
||||
task.Task = visual.DispatcherQueue.EnqueueAsync(
|
||||
() =>
|
||||
{
|
||||
const string sceneName = "PointLightScene";
|
||||
|
@ -184,7 +184,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Animations
|
|||
}
|
||||
|
||||
pointLights[visual] = pointLight;
|
||||
}, Windows.UI.Core.CoreDispatcherPriority.Normal);
|
||||
});
|
||||
|
||||
animationSet.AddAnimationThroughTask(task);
|
||||
return animationSet;
|
||||
|
|
|
@ -9,7 +9,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Animations
|
|||
/// <summary>
|
||||
/// Internal tool to link composite transforms to elements
|
||||
/// </summary>
|
||||
internal class AnimationTools : DependencyObject
|
||||
internal partial class AnimationTools : DependencyObject
|
||||
{
|
||||
/// <summary>
|
||||
/// Attached property used to link composite transform with UIElement
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<Project Sdk="MSBuild.Sdk.Extras">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>uap10.0.17763</TargetFramework>
|
||||
<TargetFrameworks>uap10.0.17763</TargetFrameworks>
|
||||
<Title>Windows Community Toolkit Animations</Title>
|
||||
<Description>
|
||||
This library provides helpers and extensions on top of Windows Composition and XAML storyboards. It is part of the Windows Community Toolkit.
|
||||
|
|
|
@ -1,253 +0,0 @@
|
|||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using Microsoft.Windows.Design.Metadata;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace Microsoft.Toolkit.Uwp.Design.Common
|
||||
{
|
||||
public class MetadataRegistrationBase
|
||||
{
|
||||
private AttributeTable masterMetadataTable;
|
||||
|
||||
internal MetadataRegistrationBase() { }
|
||||
|
||||
/// <summary>
|
||||
/// Build design time metadata attribute table.
|
||||
/// </summary>
|
||||
/// <returns>Custom attribute table.</returns>
|
||||
protected virtual AttributeTable BuildAttributeTable()
|
||||
{
|
||||
AttributeTableBuilder builder = new AttributeTableBuilder();
|
||||
|
||||
AddDescriptions(builder);
|
||||
AddAttributes(builder);
|
||||
AddTables(builder, this);
|
||||
masterMetadataTable = builder.CreateTable();
|
||||
return masterMetadataTable;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Find all AttributeTableBuilder subclasses in the assembly
|
||||
/// and add their attributes to the assembly attribute table.
|
||||
/// </summary>
|
||||
/// <param name="builder">The assembly attribute table builder.</param>
|
||||
[SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Design time dll should not fail!")]
|
||||
private void AddTables(AttributeTableBuilder builder, object parent)
|
||||
{
|
||||
Debug.Assert(builder != null, "AddTables is called with null parameter!");
|
||||
|
||||
Assembly asm = parent.GetType().Assembly;
|
||||
foreach (Type t in asm.GetTypes())
|
||||
{
|
||||
if (t.IsSubclassOf(typeof(AttributeTableBuilder)))
|
||||
{
|
||||
try
|
||||
{
|
||||
AttributeTableBuilder atb = (AttributeTableBuilder)Activator.CreateInstance(t);
|
||||
builder.AddTable(atb.CreateTable());
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
//error loading design assembly
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the case sensitive resource name of the embedded XML file.
|
||||
/// </summary>
|
||||
protected string XmlResourceName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the FullName of the corresponding run time assembly.
|
||||
/// </summary>
|
||||
protected string AssemblyFullName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Create description attribute from run time assembly xml file.
|
||||
/// </summary>
|
||||
/// <param name="builder">The assembly attribute table builder.</param>
|
||||
[SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Design time dll should not fail.")]
|
||||
private void AddDescriptions(AttributeTableBuilder builder)
|
||||
{
|
||||
Debug.Assert(builder != null, "AddDescriptions is called with null parameter!");
|
||||
|
||||
if (string.IsNullOrEmpty(XmlResourceName) ||
|
||||
string.IsNullOrEmpty(AssemblyFullName))
|
||||
{
|
||||
return;
|
||||
}
|
||||
XDocument xdoc = null;
|
||||
try
|
||||
{
|
||||
xdoc = XDocument.Load(new StreamReader(
|
||||
Assembly.GetExecutingAssembly().GetManifestResourceStream(XmlResourceName)));
|
||||
}
|
||||
catch { return; }
|
||||
if (xdoc == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (XElement member in xdoc.Descendants("member"))
|
||||
{
|
||||
try
|
||||
{
|
||||
string name = (string)member.Attribute("name");
|
||||
if (name == null)
|
||||
continue;
|
||||
bool isType = name.StartsWith("T:", StringComparison.OrdinalIgnoreCase);
|
||||
if (isType ||
|
||||
name.StartsWith("P:", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
int lastDot = name.Length;
|
||||
string typeName;
|
||||
if (isType)
|
||||
{
|
||||
typeName = name.Substring(2); // skip leading "T:"
|
||||
}
|
||||
else
|
||||
{
|
||||
lastDot = name.LastIndexOf('.');
|
||||
typeName = name.Substring(2, lastDot - 2);
|
||||
}
|
||||
typeName += AssemblyFullName;
|
||||
|
||||
Type t = Type.GetType(typeName);
|
||||
if (t != null && t.IsPublic && t.IsClass &&
|
||||
t.IsSubclassOf(Types.PlatformTypes.DependencyObjectType))
|
||||
{
|
||||
string desc = ParseDescription(member);
|
||||
if (desc == null)
|
||||
continue;
|
||||
|
||||
desc = desc.Trim();
|
||||
desc = string.Join(" ", desc.Split(new char[] { ' ', '\t', '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries));
|
||||
if (isType)
|
||||
{
|
||||
bool isBrowsable = true;
|
||||
try
|
||||
{
|
||||
isBrowsable = IsBrowsable(t);
|
||||
}
|
||||
catch { isBrowsable = false; }
|
||||
if (isBrowsable)
|
||||
builder.AddCallback(t, b => b.AddCustomAttributes(new DescriptionAttribute(desc)));
|
||||
else //Hide from intellisense
|
||||
{
|
||||
builder.AddCallback(t, b => b.AddCustomAttributes(
|
||||
new BrowsableAttribute(false),
|
||||
new Windows.Design.ToolboxBrowsableAttribute(false),
|
||||
new ToolboxItemAttribute(false)));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
string propName = name.Substring(lastDot + 1);
|
||||
PropertyInfo pi = t.GetProperty(propName, BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly);
|
||||
if (pi != null)
|
||||
{
|
||||
bool isBrowsable = true;
|
||||
try
|
||||
{
|
||||
isBrowsable = IsBrowsable(pi);
|
||||
}
|
||||
catch { isBrowsable = false; }
|
||||
if (isBrowsable)
|
||||
builder.AddCallback(t, b => b.AddCustomAttributes(propName, new DescriptionAttribute(desc)));
|
||||
else //Hide from intellisense
|
||||
builder.AddCallback(t, b => b.AddCustomAttributes(new BrowsableAttribute(false)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static bool IsBrowsable(Type t)
|
||||
{
|
||||
var attrs = t.GetCustomAttributes(Types.PlatformTypes.EditorBrowsableAttributeType, false);
|
||||
foreach (var attr in attrs)
|
||||
{
|
||||
return Types.PlatformTypes.IsBrowsable(attr);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private static bool IsBrowsable(PropertyInfo pi)
|
||||
{
|
||||
var attrs = pi.GetCustomAttributes(Types.PlatformTypes.EditorBrowsableAttributeType, false);
|
||||
foreach (var attr in attrs)
|
||||
{
|
||||
return Types.PlatformTypes.IsBrowsable(attr);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create description string from xml doc summary tag.
|
||||
/// </summary>
|
||||
/// <param name="member">A single node of the xml doc.</param>
|
||||
/// <returns>Description string.</returns>
|
||||
private static string ParseDescription(XElement member)
|
||||
{
|
||||
string desc = null;
|
||||
XElement memberDesc = member.Descendants("summary").FirstOrDefault();
|
||||
|
||||
if (memberDesc != null)
|
||||
{
|
||||
IEnumerable<XNode> nodes = memberDesc.DescendantNodes();
|
||||
|
||||
if (nodes != null)
|
||||
{
|
||||
foreach (XNode node in nodes)
|
||||
{
|
||||
if (node.NodeType == System.Xml.XmlNodeType.Text)
|
||||
{
|
||||
desc += node.ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
string s = node.ToString();
|
||||
int i = s.LastIndexOf('.');
|
||||
int j = s.LastIndexOf('"');
|
||||
|
||||
if ((i != -1 || j != -1) && j - i - 1 > 0)
|
||||
{
|
||||
try
|
||||
{
|
||||
desc += s.Substring(i + 1, j - i - 1);
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return desc;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Provide a place to add custom attributes without creating a AttributeTableBuilder subclass.
|
||||
/// </summary>
|
||||
/// <param name="builder">The assembly attribute table builder.</param>
|
||||
protected virtual void AddAttributes(AttributeTableBuilder builder)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,49 +0,0 @@
|
|||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System;
|
||||
using Microsoft.Windows.Design.Metadata;
|
||||
using Windows.UI.Xaml;
|
||||
|
||||
namespace Microsoft.Toolkit.Uwp.Design.Types
|
||||
{
|
||||
internal class PlatformTypes
|
||||
{
|
||||
public static readonly Type DependencyObjectType = typeof(DependencyObject);
|
||||
public static readonly Type UIElementType = typeof(UIElement);
|
||||
public static readonly Type FrameworkElementType = typeof(FrameworkElement);
|
||||
public static readonly Type EditorBrowsableAttributeType = typeof(System.ComponentModel.EditorBrowsableAttribute);
|
||||
|
||||
/// <summary>
|
||||
/// Used by MetadataRegistrationBase to get the browsable state
|
||||
/// </summary>
|
||||
/// <param name="editorBrowsableAttribute">This parameter must be of type 'System.ComponentModel.EditorBrowsableAttribute'</param>
|
||||
/// <returns></returns>
|
||||
public static bool IsBrowsable(object editorBrowsableAttribute)
|
||||
{
|
||||
if (editorBrowsableAttribute is System.ComponentModel.EditorBrowsableAttribute)
|
||||
return (editorBrowsableAttribute as System.ComponentModel.EditorBrowsableAttribute).State !=
|
||||
System.ComponentModel.EditorBrowsableState.Never;
|
||||
return true;
|
||||
}
|
||||
|
||||
public static class Control
|
||||
{
|
||||
public static readonly TypeIdentifier TypeId = new TypeIdentifier("http://schemas.microsoft.com/winfx/2006/xaml/presentation", "Control");
|
||||
public static readonly PropertyIdentifier BackgroundProperty = new PropertyIdentifier(TypeId, "Background");
|
||||
public static readonly PropertyIdentifier BorderBrushProperty = new PropertyIdentifier(TypeId, "BorderBrush");
|
||||
public static readonly PropertyIdentifier BorderThicknessProperty = new PropertyIdentifier(TypeId, "BorderThickness");
|
||||
}
|
||||
|
||||
public static class FrameworkElement
|
||||
{
|
||||
public static readonly TypeIdentifier TypeId = new TypeIdentifier("http://schemas.microsoft.com/winfx/2006/xaml/presentation", "FrameworkElement");
|
||||
public static readonly PropertyIdentifier MarginProperty = new PropertyIdentifier(TypeId, "Margin");
|
||||
public static readonly PropertyIdentifier HorizontalAlignmentProperty = new PropertyIdentifier(TypeId, "HorizontalAlignment");
|
||||
public static readonly PropertyIdentifier VerticalAlignmentProperty = new PropertyIdentifier(TypeId, "VerticalAlignment");
|
||||
public static readonly PropertyIdentifier HeightProperty = new PropertyIdentifier(TypeId, "Height");
|
||||
public static readonly PropertyIdentifier WidthProperty = new PropertyIdentifier(TypeId, "Width");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,120 @@
|
|||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System.ComponentModel;
|
||||
using Microsoft.Toolkit.Uwp.UI.Controls.Design.Properties;
|
||||
|
||||
using Microsoft.VisualStudio.DesignTools.Extensibility;
|
||||
using Microsoft.VisualStudio.DesignTools.Extensibility.Features;
|
||||
using Microsoft.VisualStudio.DesignTools.Extensibility.Metadata;
|
||||
using Microsoft.VisualStudio.DesignTools.Extensibility.Model;
|
||||
|
||||
namespace Microsoft.Toolkit.Uwp.UI.Controls.Design
|
||||
{
|
||||
internal class DataGridDefaults : DefaultInitializer
|
||||
{
|
||||
public override void InitializeDefaults(ModelItem item)
|
||||
{
|
||||
item.Properties[nameof(DataGrid.Height)].SetValue(50d);
|
||||
item.Properties[nameof(DataGrid.Width)].SetValue(100d);
|
||||
}
|
||||
}
|
||||
|
||||
internal class DataGridMetadata : AttributeTableBuilder
|
||||
{
|
||||
public DataGridMetadata() : base()
|
||||
{
|
||||
AddCallback(ControlTypes.DataGrid,
|
||||
b =>
|
||||
{
|
||||
b.AddCustomAttributes(new FeatureAttribute(typeof(DataGridDefaults)));
|
||||
b.AddCustomAttributes(nameof(DataGrid.AlternatingRowBackground), new CategoryAttribute(Resources.CategoryRows));
|
||||
b.AddCustomAttributes(nameof(DataGrid.AreRowDetailsFrozen), new CategoryAttribute(Resources.CategoryRows));
|
||||
b.AddCustomAttributes(nameof(DataGrid.AreRowGroupHeadersFrozen), new CategoryAttribute(Resources.CategoryHeaders));
|
||||
b.AddCustomAttributes(nameof(DataGrid.AutoGenerateColumns), new CategoryAttribute(Resources.CategoryColumns));
|
||||
b.AddCustomAttributes(nameof(DataGrid.CanUserReorderColumns), new CategoryAttribute(Resources.CategoryColumns));
|
||||
b.AddCustomAttributes(nameof(DataGrid.CanUserResizeColumns), new CategoryAttribute(Resources.CategoryColumns));
|
||||
b.AddCustomAttributes(nameof(DataGrid.CanUserSortColumns), new CategoryAttribute(Resources.CategoryColumns));
|
||||
b.AddCustomAttributes(nameof(DataGrid.CellStyle), new CategoryAttribute(Resources.CategoryColumns));
|
||||
b.AddCustomAttributes(nameof(DataGrid.ClipboardCopyMode), new CategoryAttribute(Resources.CategoryText));
|
||||
b.AddCustomAttributes(nameof(DataGrid.ColumnHeaderHeight), new CategoryAttribute(Resources.CategoryHeaders));
|
||||
b.AddCustomAttributes(nameof(DataGrid.ColumnHeaderStyle), new CategoryAttribute(Resources.CategoryHeaders));
|
||||
b.AddCustomAttributes(nameof(DataGrid.Columns), new CategoryAttribute(Resources.CategoryColumns));
|
||||
b.AddCustomAttributes(nameof(DataGrid.ColumnWidth), new CategoryAttribute(Resources.CategoryColumns));
|
||||
b.AddCustomAttributes(nameof(DataGrid.CurrentColumn), new CategoryAttribute(Resources.CategoryText));
|
||||
b.AddCustomAttributes(nameof(DataGrid.DragIndicatorStyle), new CategoryAttribute(Resources.CategoryText));
|
||||
b.AddCustomAttributes(nameof(DataGrid.DropLocationIndicatorStyle), new CategoryAttribute(Resources.CategoryText));
|
||||
b.AddCustomAttributes(nameof(DataGrid.FrozenColumnCount), new CategoryAttribute(Resources.CategoryColumns));
|
||||
b.AddCustomAttributes(nameof(DataGrid.GridLinesVisibility), new CategoryAttribute(Resources.CategoryGridLines));
|
||||
b.AddCustomAttributes(nameof(DataGrid.HeadersVisibility), new CategoryAttribute(Resources.CategoryHeaders));
|
||||
b.AddCustomAttributes(nameof(DataGrid.HorizontalGridLinesBrush), new CategoryAttribute(Resources.CategoryGridLines));
|
||||
b.AddCustomAttributes(nameof(DataGrid.HorizontalScrollBarVisibility), new CategoryAttribute(Resources.CategoryLayout));
|
||||
b.AddCustomAttributes(nameof(DataGrid.IsReadOnly), new CategoryAttribute(Resources.CategoryText));
|
||||
b.AddCustomAttributes(nameof(DataGrid.IsValid), new CategoryAttribute(Resources.CategoryText));
|
||||
b.AddCustomAttributes(nameof(DataGrid.ItemsSource), new CategoryAttribute(Resources.CategoryColumns));
|
||||
b.AddCustomAttributes(nameof(DataGrid.MaxColumnWidth), new CategoryAttribute(Resources.CategoryColumns));
|
||||
b.AddCustomAttributes(nameof(DataGrid.MinColumnWidth), new CategoryAttribute(Resources.CategoryColumns));
|
||||
b.AddCustomAttributes(nameof(DataGrid.RowBackground), new CategoryAttribute(Resources.CategoryRows));
|
||||
b.AddCustomAttributes(nameof(DataGrid.RowDetailsTemplate), new CategoryAttribute(Resources.CategoryRows));
|
||||
b.AddCustomAttributes(nameof(DataGrid.RowDetailsVisibilityMode), new CategoryAttribute(Resources.CategoryRows));
|
||||
b.AddCustomAttributes(nameof(DataGrid.RowGroupHeaderPropertyNameAlternative), new CategoryAttribute(Resources.CategoryHeaders));
|
||||
b.AddCustomAttributes(nameof(DataGrid.RowGroupHeaderStyles), new CategoryAttribute(Resources.CategoryHeaders));
|
||||
b.AddCustomAttributes(nameof(DataGrid.RowHeaderStyle), new CategoryAttribute(Resources.CategoryHeaders));
|
||||
b.AddCustomAttributes(nameof(DataGrid.RowHeaderWidth), new CategoryAttribute(Resources.CategoryHeaders));
|
||||
b.AddCustomAttributes(nameof(DataGrid.RowHeight), new CategoryAttribute(Resources.CategoryRows));
|
||||
b.AddCustomAttributes(nameof(DataGrid.RowStyle), new CategoryAttribute(Resources.CategoryRows));
|
||||
b.AddCustomAttributes(nameof(DataGrid.SelectedIndex), new CategoryAttribute(Resources.CategoryCommon));
|
||||
b.AddCustomAttributes(nameof(DataGrid.SelectedItem), new CategoryAttribute(Resources.CategoryCommon));
|
||||
b.AddCustomAttributes(nameof(DataGrid.SelectedItems), new CategoryAttribute(Resources.CategoryAppearance));
|
||||
b.AddCustomAttributes(nameof(DataGrid.SelectionMode), new CategoryAttribute(Resources.CategoryRows));
|
||||
b.AddCustomAttributes(nameof(DataGrid.VerticalGridLinesBrush), new CategoryAttribute(Resources.CategoryGridLines));
|
||||
b.AddCustomAttributes(nameof(DataGrid.VerticalScrollBarVisibility), new CategoryAttribute(Resources.CategoryLayout));
|
||||
b.AddCustomAttributes(new ToolboxCategoryAttribute(ToolboxCategoryPaths.Toolkit, false));
|
||||
});
|
||||
|
||||
AddCallback(ControlTypes.DataGridColumn,
|
||||
b =>
|
||||
{
|
||||
b.AddCustomAttributes(nameof(DataGridColumn.CanUserResize), new CategoryAttribute(Resources.CategoryLayout));
|
||||
b.AddCustomAttributes(nameof(DataGridColumn.CanUserSort), new CategoryAttribute(Resources.CategorySort));
|
||||
b.AddCustomAttributes(nameof(DataGridColumn.Header), new CategoryAttribute(Resources.CategoryHeader));
|
||||
b.AddCustomAttributes(nameof(DataGridColumn.HeaderStyle), new CategoryAttribute(Resources.CategoryHeader));
|
||||
b.AddCustomAttributes(nameof(DataGridColumn.MaxWidth), new CategoryAttribute(Resources.CategoryLayout));
|
||||
b.AddCustomAttributes(nameof(DataGridColumn.MinWidth), new CategoryAttribute(Resources.CategoryLayout));
|
||||
b.AddCustomAttributes(nameof(DataGridColumn.SortDirection), new CategoryAttribute(Resources.CategorySort));
|
||||
b.AddCustomAttributes(nameof(DataGridColumn.Visibility), new CategoryAttribute(Resources.CategoryAppearance));
|
||||
b.AddCustomAttributes(nameof(DataGridColumn.Width), new CategoryAttribute(Resources.CategoryLayout));
|
||||
});
|
||||
|
||||
AddCallback(ControlTypes.DataGridBoundColumn,
|
||||
b =>
|
||||
{
|
||||
b.AddCustomAttributes(nameof(DataGridBoundColumn.Binding), new CategoryAttribute(Resources.CategoryCellBinding));
|
||||
});
|
||||
|
||||
AddCallback(ControlTypes.DataGridTextColumn,
|
||||
b =>
|
||||
{
|
||||
b.AddCustomAttributes(nameof(DataGridTextColumn.FontFamily), new CategoryAttribute(Resources.CategoryText));
|
||||
b.AddCustomAttributes(nameof(DataGridTextColumn.FontSize), new CategoryAttribute(Resources.CategoryText));
|
||||
b.AddCustomAttributes(nameof(DataGridTextColumn.FontStyle), new CategoryAttribute(Resources.CategoryText));
|
||||
b.AddCustomAttributes(nameof(DataGridTextColumn.FontWeight), new CategoryAttribute(Resources.CategoryText));
|
||||
b.AddCustomAttributes(nameof(DataGridTextColumn.Foreground), new CategoryAttribute(Resources.CategoryText));
|
||||
});
|
||||
|
||||
AddCallback(ControlTypes.DataGridCheckBoxColumn,
|
||||
b =>
|
||||
{
|
||||
b.AddCustomAttributes(nameof(DataGridCheckBoxColumn.IsThreeState), new CategoryAttribute(Resources.CategoryCommon));
|
||||
});
|
||||
|
||||
AddCallback(ControlTypes.DataGridTemplateColumn,
|
||||
b =>
|
||||
{
|
||||
b.AddCustomAttributes(nameof(DataGridTemplateColumn.CellEditingTemplate), new CategoryAttribute(Resources.CategoryCellTemplate));
|
||||
b.AddCustomAttributes(nameof(DataGridTemplateColumn.CellTemplate), new CategoryAttribute(Resources.CategoryCellTemplate));
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,103 @@
|
|||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System;
|
||||
|
||||
namespace Microsoft.Toolkit.Uwp.UI.Controls.Design
|
||||
{
|
||||
internal static partial class ControlTypes
|
||||
{
|
||||
internal const string DataGrid = RootNamespace + "." + nameof(DataGrid);
|
||||
internal const string DataGridColumn = RootNamespace + "." + nameof(DataGridColumn);
|
||||
internal const string DataGridBoundColumn = RootNamespace + "." + nameof(DataGridBoundColumn);
|
||||
internal const string DataGridTextColumn = RootNamespace + "." + nameof(DataGridTextColumn);
|
||||
internal const string DataGridCheckBoxColumn = RootNamespace + "." + nameof(DataGridCheckBoxColumn);
|
||||
internal const string DataGridTemplateColumn = RootNamespace + "." + nameof(DataGridTemplateColumn);
|
||||
}
|
||||
|
||||
internal static class DataGrid
|
||||
{
|
||||
internal const string AlternatingRowBackground = nameof(AlternatingRowBackground);
|
||||
internal const string AreRowDetailsFrozen = nameof(AreRowDetailsFrozen);
|
||||
internal const string AreRowGroupHeadersFrozen = nameof(AreRowGroupHeadersFrozen);
|
||||
internal const string AutoGenerateColumns = nameof(AutoGenerateColumns);
|
||||
internal const string CanUserReorderColumns = nameof(CanUserReorderColumns);
|
||||
internal const string CanUserResizeColumns = nameof(CanUserResizeColumns);
|
||||
internal const string CanUserSortColumns = nameof(CanUserSortColumns);
|
||||
internal const string CellStyle = nameof(CellStyle);
|
||||
internal const string ClipboardCopyMode = nameof(ClipboardCopyMode);
|
||||
internal const string ColumnHeaderHeight = nameof(ColumnHeaderHeight);
|
||||
internal const string ColumnHeaderStyle = nameof(ColumnHeaderStyle);
|
||||
internal const string Columns = nameof(Columns);
|
||||
internal const string ColumnWidth = nameof(ColumnWidth);
|
||||
internal const string CurrentColumn = nameof(CurrentColumn);
|
||||
internal const string DragIndicatorStyle = nameof(DragIndicatorStyle);
|
||||
internal const string DropLocationIndicatorStyle = nameof(DropLocationIndicatorStyle);
|
||||
internal const string FrozenColumnCount = nameof(FrozenColumnCount);
|
||||
internal const string GridLinesVisibility = nameof(GridLinesVisibility);
|
||||
internal const string HeadersVisibility = nameof(HeadersVisibility);
|
||||
internal const string Height = nameof(Height);
|
||||
internal const string HorizontalGridLinesBrush = nameof(HorizontalGridLinesBrush);
|
||||
internal const string HorizontalScrollBarVisibility = nameof(HorizontalScrollBarVisibility);
|
||||
internal const string IsReadOnly = nameof(IsReadOnly);
|
||||
internal const string IsValid = nameof(IsValid);
|
||||
internal const string ItemsSource = nameof(ItemsSource);
|
||||
internal const string MaxColumnWidth = nameof(MaxColumnWidth);
|
||||
internal const string MinColumnWidth = nameof(MinColumnWidth);
|
||||
internal const string RowBackground = nameof(RowBackground);
|
||||
internal const string RowDetailsTemplate = nameof(RowDetailsTemplate);
|
||||
internal const string RowDetailsVisibilityMode = nameof(RowDetailsVisibilityMode);
|
||||
internal const string RowGroupHeaderPropertyNameAlternative = nameof(RowGroupHeaderPropertyNameAlternative);
|
||||
internal const string RowGroupHeaderStyles = nameof(RowGroupHeaderStyles);
|
||||
internal const string RowHeaderStyle = nameof(RowHeaderStyle);
|
||||
internal const string RowHeaderWidth = nameof(RowHeaderWidth);
|
||||
internal const string RowHeight = nameof(RowHeight);
|
||||
internal const string RowStyle = nameof(RowStyle);
|
||||
internal const string SelectedIndex = nameof(SelectedIndex);
|
||||
internal const string SelectedItem = nameof(SelectedItem);
|
||||
internal const string SelectedItems = nameof(SelectedItems);
|
||||
internal const string SelectionMode = nameof(SelectionMode);
|
||||
internal const string VerticalGridLinesBrush = nameof(VerticalGridLinesBrush);
|
||||
internal const string VerticalScrollBarVisibility = nameof(VerticalScrollBarVisibility);
|
||||
internal const string Width = nameof(Width);
|
||||
}
|
||||
|
||||
internal static class DataGridColumn
|
||||
{
|
||||
internal const string CanUserResize = nameof(CanUserResize);
|
||||
internal const string CanUserSort = nameof(CanUserSort);
|
||||
internal const string Header = nameof(Header);
|
||||
internal const string HeaderStyle = nameof(HeaderStyle);
|
||||
internal const string MaxWidth = nameof(MaxWidth);
|
||||
internal const string MinWidth = nameof(MinWidth);
|
||||
internal const string SortDirection = nameof(SortDirection);
|
||||
internal const string Visibility = nameof(Visibility);
|
||||
internal const string Width = nameof(Width);
|
||||
}
|
||||
|
||||
internal static class DataGridBoundColumn
|
||||
{
|
||||
internal const string Binding = nameof(Binding);
|
||||
}
|
||||
|
||||
internal static class DataGridTextColumn
|
||||
{
|
||||
internal const string FontFamily = nameof(FontFamily);
|
||||
internal const string FontSize = nameof(FontSize);
|
||||
internal const string FontStyle = nameof(FontStyle);
|
||||
internal const string FontWeight = nameof(FontWeight);
|
||||
internal const string Foreground = nameof(Foreground);
|
||||
}
|
||||
|
||||
internal static class DataGridCheckBoxColumn
|
||||
{
|
||||
internal const string IsThreeState = nameof(IsThreeState);
|
||||
}
|
||||
|
||||
internal static class DataGridTemplateColumn
|
||||
{
|
||||
internal const string CellEditingTemplate = nameof(CellEditingTemplate);
|
||||
internal const string CellTemplate = nameof(CellTemplate);
|
||||
}
|
||||
}
|
|
@ -1,118 +0,0 @@
|
|||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using Microsoft.Toolkit.Uwp.UI.Controls.Design.Common;
|
||||
using Microsoft.Windows.Design;
|
||||
//using Microsoft.Windows.Design.Features;
|
||||
using Microsoft.Windows.Design.Metadata;
|
||||
//using Microsoft.Windows.Design.Model;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace Microsoft.Toolkit.Uwp.UI.Controls.Design
|
||||
{
|
||||
//internal class DataGridDefaults : DefaultInitializer
|
||||
//{
|
||||
// public override void InitializeDefaults(ModelItem item)
|
||||
// {
|
||||
// item.Properties[nameof(DataGrid.MyProperty)].SetValue(<value other than runtime default>);
|
||||
// }
|
||||
//}
|
||||
|
||||
internal class DataGridMetadata : AttributeTableBuilder
|
||||
{
|
||||
public DataGridMetadata() : base()
|
||||
{
|
||||
AddCallback(typeof(DataGrid),
|
||||
b =>
|
||||
{
|
||||
//b.AddCustomAttributes(new FeatureAttribute(typeof(DataGridDefaults)));
|
||||
b.AddCustomAttributes(nameof(DataGrid.AlternatingRowBackground), new CategoryAttribute(Properties.Resources.CategoryRows));
|
||||
b.AddCustomAttributes(nameof(DataGrid.AreRowDetailsFrozen), new CategoryAttribute(Properties.Resources.CategoryRows));
|
||||
b.AddCustomAttributes(nameof(DataGrid.AreRowGroupHeadersFrozen), new CategoryAttribute(Properties.Resources.CategoryHeaders));
|
||||
b.AddCustomAttributes(nameof(DataGrid.AutoGenerateColumns), new CategoryAttribute(Properties.Resources.CategoryColumns));
|
||||
b.AddCustomAttributes(nameof(DataGrid.CanUserReorderColumns), new CategoryAttribute(Properties.Resources.CategoryColumns));
|
||||
b.AddCustomAttributes(nameof(DataGrid.CanUserResizeColumns), new CategoryAttribute(Properties.Resources.CategoryColumns));
|
||||
b.AddCustomAttributes(nameof(DataGrid.CanUserSortColumns), new CategoryAttribute(Properties.Resources.CategoryColumns));
|
||||
b.AddCustomAttributes(nameof(DataGrid.CellStyle), new CategoryAttribute(Properties.Resources.CategoryColumns));
|
||||
b.AddCustomAttributes(nameof(DataGrid.ClipboardCopyMode), new CategoryAttribute(Properties.Resources.CategoryText));
|
||||
b.AddCustomAttributes(nameof(DataGrid.ColumnHeaderHeight), new CategoryAttribute(Properties.Resources.CategoryHeaders));
|
||||
b.AddCustomAttributes(nameof(DataGrid.ColumnHeaderStyle), new CategoryAttribute(Properties.Resources.CategoryHeaders));
|
||||
b.AddCustomAttributes(nameof(DataGrid.Columns), new CategoryAttribute(Properties.Resources.CategoryColumns));
|
||||
b.AddCustomAttributes(nameof(DataGrid.ColumnWidth), new CategoryAttribute(Properties.Resources.CategoryColumns));
|
||||
b.AddCustomAttributes(nameof(DataGrid.CurrentColumn), new CategoryAttribute(Properties.Resources.CategoryText));
|
||||
b.AddCustomAttributes(nameof(DataGrid.DragIndicatorStyle), new CategoryAttribute(Properties.Resources.CategoryText));
|
||||
b.AddCustomAttributes(nameof(DataGrid.DropLocationIndicatorStyle), new CategoryAttribute(Properties.Resources.CategoryText));
|
||||
b.AddCustomAttributes(nameof(DataGrid.FrozenColumnCount), new CategoryAttribute(Properties.Resources.CategoryColumns));
|
||||
b.AddCustomAttributes(nameof(DataGrid.GridLinesVisibility), new CategoryAttribute(Properties.Resources.CategoryGridLines));
|
||||
b.AddCustomAttributes(nameof(DataGrid.HeadersVisibility), new CategoryAttribute(Properties.Resources.CategoryHeaders));
|
||||
b.AddCustomAttributes(nameof(DataGrid.HorizontalGridLinesBrush), new CategoryAttribute(Properties.Resources.CategoryGridLines));
|
||||
b.AddCustomAttributes(nameof(DataGrid.HorizontalScrollBarVisibility), new CategoryAttribute(Properties.Resources.CategoryLayout));
|
||||
b.AddCustomAttributes(nameof(DataGrid.IsReadOnly), new CategoryAttribute(Properties.Resources.CategoryText));
|
||||
b.AddCustomAttributes(nameof(DataGrid.IsValid), new CategoryAttribute(Properties.Resources.CategoryText));
|
||||
b.AddCustomAttributes(nameof(DataGrid.ItemsSource), new CategoryAttribute(Properties.Resources.CategoryColumns));
|
||||
b.AddCustomAttributes(nameof(DataGrid.MaxColumnWidth), new CategoryAttribute(Properties.Resources.CategoryColumns));
|
||||
b.AddCustomAttributes(nameof(DataGrid.MinColumnWidth), new CategoryAttribute(Properties.Resources.CategoryColumns));
|
||||
b.AddCustomAttributes(nameof(DataGrid.RowBackground), new CategoryAttribute(Properties.Resources.CategoryRows));
|
||||
b.AddCustomAttributes(nameof(DataGrid.RowDetailsTemplate), new CategoryAttribute(Properties.Resources.CategoryRows));
|
||||
b.AddCustomAttributes(nameof(DataGrid.RowDetailsVisibilityMode), new CategoryAttribute(Properties.Resources.CategoryRows));
|
||||
b.AddCustomAttributes(nameof(DataGrid.RowGroupHeaderPropertyNameAlternative), new CategoryAttribute(Properties.Resources.CategoryHeaders));
|
||||
b.AddCustomAttributes(nameof(DataGrid.RowGroupHeaderStyles), new CategoryAttribute(Properties.Resources.CategoryHeaders));
|
||||
b.AddCustomAttributes(nameof(DataGrid.RowHeaderStyle), new CategoryAttribute(Properties.Resources.CategoryHeaders));
|
||||
b.AddCustomAttributes(nameof(DataGrid.RowHeaderWidth), new CategoryAttribute(Properties.Resources.CategoryHeaders));
|
||||
b.AddCustomAttributes(nameof(DataGrid.RowHeight), new CategoryAttribute(Properties.Resources.CategoryRows));
|
||||
b.AddCustomAttributes(nameof(DataGrid.RowStyle), new CategoryAttribute(Properties.Resources.CategoryRows));
|
||||
b.AddCustomAttributes(nameof(DataGrid.SelectedIndex), new CategoryAttribute(Properties.Resources.CategoryCommon));
|
||||
b.AddCustomAttributes(nameof(DataGrid.SelectedItem), new CategoryAttribute(Properties.Resources.CategoryCommon));
|
||||
b.AddCustomAttributes(nameof(DataGrid.SelectedItems), new CategoryAttribute(Properties.Resources.CategoryAppearance));
|
||||
b.AddCustomAttributes(nameof(DataGrid.SelectionMode), new CategoryAttribute(Properties.Resources.CategoryRows));
|
||||
b.AddCustomAttributes(nameof(DataGrid.VerticalGridLinesBrush), new CategoryAttribute(Properties.Resources.CategoryGridLines));
|
||||
b.AddCustomAttributes(nameof(DataGrid.VerticalScrollBarVisibility), new CategoryAttribute(Properties.Resources.CategoryLayout));
|
||||
b.AddCustomAttributes(new ToolboxCategoryAttribute(ToolboxCategoryPaths.Toolkit, false));
|
||||
});
|
||||
|
||||
AddCallback(typeof(DataGridColumn),
|
||||
b =>
|
||||
{
|
||||
b.AddCustomAttributes(nameof(DataGridColumn.CanUserResize), new CategoryAttribute(Properties.Resources.CategoryLayout));
|
||||
b.AddCustomAttributes(nameof(DataGridColumn.CanUserSort), new CategoryAttribute(Properties.Resources.CategorySort));
|
||||
b.AddCustomAttributes(nameof(DataGridColumn.Header), new CategoryAttribute(Properties.Resources.CategoryHeader));
|
||||
b.AddCustomAttributes(nameof(DataGridColumn.HeaderStyle), new CategoryAttribute(Properties.Resources.CategoryHeader));
|
||||
b.AddCustomAttributes(nameof(DataGridColumn.MaxWidth), new CategoryAttribute(Properties.Resources.CategoryLayout));
|
||||
b.AddCustomAttributes(nameof(DataGridColumn.MinWidth), new CategoryAttribute(Properties.Resources.CategoryLayout));
|
||||
b.AddCustomAttributes(nameof(DataGridColumn.SortDirection), new CategoryAttribute(Properties.Resources.CategorySort));
|
||||
b.AddCustomAttributes(nameof(DataGridColumn.Visibility), new CategoryAttribute(Properties.Resources.CategoryAppearance));
|
||||
b.AddCustomAttributes(nameof(DataGridColumn.Width), new CategoryAttribute(Properties.Resources.CategoryLayout));
|
||||
});
|
||||
|
||||
AddCallback(typeof(DataGridBoundColumn),
|
||||
b =>
|
||||
{
|
||||
b.AddCustomAttributes(nameof(DataGridBoundColumn.Binding), new CategoryAttribute(Properties.Resources.CategoryCellBinding));
|
||||
});
|
||||
|
||||
AddCallback(typeof(DataGridTextColumn),
|
||||
b =>
|
||||
{
|
||||
b.AddCustomAttributes(nameof(DataGridTextColumn.FontFamily), new CategoryAttribute(Properties.Resources.CategoryText));
|
||||
b.AddCustomAttributes(nameof(DataGridTextColumn.FontSize), new CategoryAttribute(Properties.Resources.CategoryText));
|
||||
b.AddCustomAttributes(nameof(DataGridTextColumn.FontStyle), new CategoryAttribute(Properties.Resources.CategoryText));
|
||||
b.AddCustomAttributes(nameof(DataGridTextColumn.FontWeight), new CategoryAttribute(Properties.Resources.CategoryText));
|
||||
b.AddCustomAttributes(nameof(DataGridTextColumn.Foreground), new CategoryAttribute(Properties.Resources.CategoryText));
|
||||
});
|
||||
|
||||
AddCallback(typeof(DataGridCheckBoxColumn),
|
||||
b =>
|
||||
{
|
||||
b.AddCustomAttributes(nameof(DataGridCheckBoxColumn.IsThreeState), new CategoryAttribute(Properties.Resources.CategoryCommon));
|
||||
});
|
||||
|
||||
AddCallback(typeof(DataGridTemplateColumn),
|
||||
b =>
|
||||
{
|
||||
b.AddCustomAttributes(nameof(DataGridTemplateColumn.CellEditingTemplate), new CategoryAttribute(Properties.Resources.CategoryCellTemplate));
|
||||
b.AddCustomAttributes(nameof(DataGridTemplateColumn.CellTemplate), new CategoryAttribute(Properties.Resources.CategoryCellTemplate));
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,46 +0,0 @@
|
|||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using Microsoft.Windows.Design.Metadata;
|
||||
using Microsoft.Toolkit.Uwp.Design.Common;
|
||||
|
||||
[assembly: ProvideMetadata(typeof(Microsoft.Toolkit.Uwp.UI.Controls.Design.MetadataRegistration))]
|
||||
|
||||
namespace Microsoft.Toolkit.Uwp.UI.Controls.Design
|
||||
{
|
||||
public class MetadataRegistration : MetadataRegistrationBase, IProvideAttributeTable
|
||||
{
|
||||
public MetadataRegistration() : base()
|
||||
{
|
||||
// Note:
|
||||
// The default constructor sets value of AssemblyFullName and
|
||||
// XmlResourceName used by MetadataRegistrationBase.AddDescriptions().
|
||||
// The convention here is that the <RootNamespace> in .design.csproj
|
||||
// (or Default namespace in Project -> Properties -> Application tab)
|
||||
// must be the same as runtime assembly's main namespace (t.Namespace)
|
||||
// plus .Design.
|
||||
Type t = typeof(Microsoft.Toolkit.Uwp.UI.Controls.DataGrid);
|
||||
AssemblyName an = t.Assembly.GetName();
|
||||
AssemblyFullName = ", " + an.FullName;
|
||||
XmlResourceName = t.Namespace + ".Design." + an.Name + ".xml";
|
||||
}
|
||||
|
||||
#region IProvideAttributeTable Members
|
||||
|
||||
/// <summary>
|
||||
/// Gets the AttributeTable for design time metadata.
|
||||
/// </summary>
|
||||
public AttributeTable AttributeTable
|
||||
{
|
||||
get
|
||||
{
|
||||
return BuildAttributeTable();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -8,21 +8,18 @@
|
|||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Microsoft.Toolkit.Uwp.UI.Controls.Design</RootNamespace>
|
||||
<AssemblyName>Microsoft.Toolkit.Uwp.UI.Controls.DataGrid.Design</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<AssemblyName>Microsoft.Toolkit.Uwp.UI.Controls.DataGrid.DesignTools</AssemblyName>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<TargetFrameworkProfile />
|
||||
<AssetTargetFallback>$(AssetTargetFallback);uap10.0.17763</AssetTargetFallback>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<TargetPlatformVersion>8.1</TargetPlatformVersion>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<ValidateFrameworkCompatibility>false</ValidateFrameworkCompatibility>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>..\Microsoft.Toolkit.Uwp.UI.Controls.DataGrid\bin\Debug\uap10.0.17763\Design\</OutputPath>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<DefineConstants>TRACE;DEBUG</DefineConstants>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
|
||||
|
@ -33,18 +30,18 @@
|
|||
<DefineConstants>TRACE</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ValidateFrameworkCompatibility>false</ValidateFrameworkCompatibility>
|
||||
<AssetTargetFallback>$(AssetTargetFallback);uap10.0.17763</AssetTargetFallback>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System.Runtime" />
|
||||
<Reference Include="System.ObjectModel" />
|
||||
<Reference Include="System.Runtime.WindowsRuntime" />
|
||||
<Reference Include="System.Runtime.InteropServices.WindowsRuntime" />
|
||||
<Reference Include="Microsoft.Windows.Design.Extensibility">
|
||||
<Reference Include="Microsoft.VisualStudio.DesignTools.Extensibility">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Windows.Design.Interaction">
|
||||
<Reference Include="Microsoft.VisualStudio.DesignTools.Interaction">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
|
@ -62,12 +59,6 @@
|
|||
<Reference Include="WindowsBase" />
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="PresentationFramework" />
|
||||
<ProjectReference Include="..\Microsoft.Toolkit.Uwp.UI.Controls.DataGrid\Microsoft.Toolkit.Uwp.UI.Controls.DataGrid.csproj" Condition="'$(ExcludeRestorePackageImports)' != 'true'">
|
||||
<Project>{daeb9cec-c817-33b2-74b2-bc379380db72}</Project>
|
||||
<Name>Microsoft.Toolkit.Uwp.UI.Controls.DataGrid</Name>
|
||||
<Private>False</Private>
|
||||
<SkipGetTargetFrameworkProperties>true</SkipGetTargetFrameworkProperties>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup Label="WinRT References">
|
||||
<Reference Include="System.Xaml" />
|
||||
|
@ -84,9 +75,12 @@
|
|||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="MetadataRegistration.cs" />
|
||||
<Compile Include="Common\MetadataRegistrationBase.cs" />
|
||||
<Compile Include="Common\PlatformTypes.cs" />
|
||||
<Compile Include="..\Microsoft.Toolkit.Uwp.UI.Controls.Design\Common\Constants.cs" Link="Common\Constants.cs" />
|
||||
<Compile Include="..\Microsoft.Toolkit.Uwp.UI.Controls.Design\Common\MetadataRegistrationBase.cs" Link="Common\MetadataRegistrationBase.cs" />
|
||||
<Compile Include="..\Microsoft.Toolkit.Uwp.UI.Controls.Design\Common\PlatformTypes.cs" Link="Common\PlatformTypes.cs" />
|
||||
<Compile Include="..\Microsoft.Toolkit.Uwp.UI.Controls.Design\MetadataRegistration.cs" Link="MetadataRegistration.cs" />
|
||||
<Compile Include="Controls\DataGrid.Metadata.cs" />
|
||||
<Compile Include="Controls\DataGrid.Typedata.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
|
@ -95,31 +89,19 @@
|
|||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Properties\Settings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
<Compile Include="Common\ToolboxCategoryPaths.cs" />
|
||||
<Compile Include="DataGridMetadata.cs" />
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
<AppDesigner Include="Properties\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="..\Microsoft.Toolkit.Uwp.UI.Controls.DataGrid\bin\$(Configuration)\uap10.0.17763\Microsoft.Toolkit.Uwp.UI.Controls.DataGrid.xml">
|
||||
<Link>Microsoft.Toolkit.Uwp.UI.Controls.DataGrid.xml</Link>
|
||||
<SubType>Designer</SubType>
|
||||
<Visible>False</Visible>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Target Name="Pack">
|
||||
<!-- No-op to avoid build error when packing solution from commandline -->
|
||||
</Target>
|
||||
<!-- No-op to avoid build error when packing solution from commandline -->
|
||||
<Target Name="Pack" />
|
||||
</Project>
|
|
@ -3,12 +3,9 @@
|
|||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System.Reflection;
|
||||
using System.Resources;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("Windows Community Toolkit Controls DataGrid (Design)")]
|
||||
|
@ -20,12 +17,12 @@ using System.Windows;
|
|||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
//In order to begin building localizable applications, set
|
||||
//In order to begin building localizable applications, set
|
||||
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
|
||||
//inside a <PropertyGroup>. For example, if you are using US English
|
||||
//in your source files, set the <UICulture> to en-US. Then uncomment
|
||||
|
|
|
@ -1,26 +0,0 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Microsoft.Toolkit.Uwp.UI.Controls.Design.Properties {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.3.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
public static Settings Default {
|
||||
get {
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
|
||||
<Profiles>
|
||||
<Profile Name="(Default)" />
|
||||
</Profiles>
|
||||
<Settings />
|
||||
</SettingsFile>
|
|
@ -12,6 +12,8 @@ using System.Diagnostics;
|
|||
using System.Reflection; // ConstructorInfo
|
||||
#endif
|
||||
|
||||
using DiagnosticsDebug = System.Diagnostics.Debug;
|
||||
|
||||
namespace Microsoft.Toolkit.Uwp.UI.Data.Utilities
|
||||
{
|
||||
/// <summary>
|
||||
|
@ -563,7 +565,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Data.Utilities
|
|||
BeginAddNew(newItem, index);
|
||||
}
|
||||
|
||||
Debug.Assert(_newItemIndex != -2 && object.Equals(newItem, _newItem), "AddNew did not raise expected events");
|
||||
DiagnosticsDebug.Assert(_newItemIndex != -2 && object.Equals(newItem, _newItem), "AddNew did not raise expected events");
|
||||
|
||||
MoveCurrentTo(newItem);
|
||||
|
||||
|
@ -588,7 +590,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Data.Utilities
|
|||
// related to AddNew. This method is called from ProcessCollectionChanged.
|
||||
private void BeginAddNew(object newItem, int index)
|
||||
{
|
||||
Debug.Assert(_newItemIndex == -2 && _newItem == NoNewItem, "unexpected call to BeginAddNew");
|
||||
DiagnosticsDebug.Assert(_newItemIndex == -2 && _newItem == NoNewItem, "unexpected call to BeginAddNew");
|
||||
|
||||
// remember the new item and its position in the underlying list
|
||||
SetNewItem(newItem);
|
||||
|
@ -810,7 +812,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Data.Utilities
|
|||
{
|
||||
if (!object.Equals(item, _newItem))
|
||||
{
|
||||
Debug.Assert(item == NoNewItem || this._newItem == NoNewItem, "Old and new _newItem values are unexpectedly different from NoNewItem");
|
||||
DiagnosticsDebug.Assert(item == NoNewItem || this._newItem == NoNewItem, "Old and new _newItem values are unexpectedly different from NoNewItem");
|
||||
_newItem = item;
|
||||
|
||||
OnPropertyChanged(CurrentAddItemPropertyName);
|
||||
|
@ -1193,7 +1195,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Data.Utilities
|
|||
{
|
||||
if (!object.Equals(item, _editItem))
|
||||
{
|
||||
Debug.Assert(item == null || _editItem == null, "Old and new _editItem values are unexpectedly non null");
|
||||
DiagnosticsDebug.Assert(item == null || _editItem == null, "Old and new _editItem values are unexpectedly non null");
|
||||
_editItem = item;
|
||||
|
||||
OnPropertyChanged(CurrentEditItemPropertyName);
|
||||
|
@ -1543,7 +1545,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Data.Utilities
|
|||
break;
|
||||
|
||||
default:
|
||||
Debug.Assert(false, "Unexpected Effective Collection Change Action");
|
||||
DiagnosticsDebug.Assert(false, "Unexpected Effective Collection Change Action");
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1571,7 +1573,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Data.Utilities
|
|||
// so any changes to the current item will only be raised once, and from this method
|
||||
// _currentChangedMonitor is used to guard whether the CurrentChanged and CurrentChanging event can be fired
|
||||
// so by entering it we're preventing the base calls from firing those events.
|
||||
Debug.Assert(!CurrentChangedMonitor.Busy, "Expected _currentChangedMonitor.Busy is false.");
|
||||
DiagnosticsDebug.Assert(!CurrentChangedMonitor.Busy, "Expected _currentChangedMonitor.Busy is false.");
|
||||
|
||||
CurrentChangedMonitor.Enter();
|
||||
using (CurrentChangedMonitor)
|
||||
|
@ -1910,23 +1912,23 @@ namespace Microsoft.Toolkit.Uwp.UI.Data.Utilities
|
|||
switch (e.Action)
|
||||
{
|
||||
case NotifyCollectionChangedAction.Add:
|
||||
Debug.Assert(e.NewItems.Count == 1, "Unexpected NotifyCollectionChangedEventArgs.NewItems.Count for Add action");
|
||||
DiagnosticsDebug.Assert(e.NewItems.Count == 1, "Unexpected NotifyCollectionChangedEventArgs.NewItems.Count for Add action");
|
||||
break;
|
||||
|
||||
case NotifyCollectionChangedAction.Remove:
|
||||
Debug.Assert(e.OldItems.Count == 1, "Unexpected NotifyCollectionChangedEventArgs.OldItems.Count for Remove action");
|
||||
DiagnosticsDebug.Assert(e.OldItems.Count == 1, "Unexpected NotifyCollectionChangedEventArgs.OldItems.Count for Remove action");
|
||||
break;
|
||||
|
||||
case NotifyCollectionChangedAction.Replace:
|
||||
Debug.Assert(e.OldItems.Count == 1, "Unexpected NotifyCollectionChangedEventArgs.OldItems.Count for Replace action");
|
||||
Debug.Assert(e.NewItems.Count == 1, "Unexpected NotifyCollectionChangedEventArgs.NewItems.Count for Replace action");
|
||||
DiagnosticsDebug.Assert(e.OldItems.Count == 1, "Unexpected NotifyCollectionChangedEventArgs.OldItems.Count for Replace action");
|
||||
DiagnosticsDebug.Assert(e.NewItems.Count == 1, "Unexpected NotifyCollectionChangedEventArgs.NewItems.Count for Replace action");
|
||||
break;
|
||||
|
||||
case NotifyCollectionChangedAction.Reset:
|
||||
break;
|
||||
|
||||
default:
|
||||
Debug.Assert(false, "Unexpected NotifyCollectionChangedEventArgs action");
|
||||
DiagnosticsDebug.Assert(false, "Unexpected NotifyCollectionChangedEventArgs action");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -2308,7 +2310,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Data.Utilities
|
|||
|
||||
if (_sort != null)
|
||||
{
|
||||
Debug.Assert(_sort.Count == 0, "must be empty SortDescription collection");
|
||||
DiagnosticsDebug.Assert(_sort.Count == 0, "must be empty SortDescription collection");
|
||||
((INotifyCollectionChanged)_sort).CollectionChanged += new NotifyCollectionChangedEventHandler(SortDescriptionsChanged);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,6 +15,8 @@ using Windows.UI.Xaml.Controls;
|
|||
using Windows.UI.Xaml.Controls.Primitives;
|
||||
using Windows.UI.Xaml.Data;
|
||||
|
||||
using DiagnosticsDebug = System.Diagnostics.Debug;
|
||||
|
||||
namespace Microsoft.Toolkit.Uwp.UI.Automation.Peers
|
||||
{
|
||||
/// <summary>
|
||||
|
@ -286,8 +288,8 @@ namespace Microsoft.Toolkit.Uwp.UI.Automation.Peers
|
|||
column++;
|
||||
}
|
||||
|
||||
Debug.Assert(column >= 0, "Expected positive column value.");
|
||||
Debug.Assert(column < this.OwningDataGrid.ColumnsItemsInternal.Count, "Expected smaller column value.");
|
||||
DiagnosticsDebug.Assert(column >= 0, "Expected positive column value.");
|
||||
DiagnosticsDebug.Assert(column < this.OwningDataGrid.ColumnsItemsInternal.Count, "Expected smaller column value.");
|
||||
DataGridCell cell = dgr.Cells[column];
|
||||
AutomationPeer peer = CreatePeerForElement(cell);
|
||||
if (peer != null)
|
||||
|
@ -557,8 +559,8 @@ namespace Microsoft.Toolkit.Uwp.UI.Automation.Peers
|
|||
DataGridRow row = this.OwningDataGrid.DisplayData.GetDisplayedElement(slot) as DataGridRow;
|
||||
if (row != null)
|
||||
{
|
||||
Debug.Assert(column >= 0, "Expected positive column value.");
|
||||
Debug.Assert(column < this.OwningDataGrid.ColumnsItemsInternal.Count, "Expected smaller column value.");
|
||||
DiagnosticsDebug.Assert(column >= 0, "Expected positive column value.");
|
||||
DiagnosticsDebug.Assert(column < this.OwningDataGrid.ColumnsItemsInternal.Count, "Expected smaller column value.");
|
||||
DataGridCell cell = row.Cells[column];
|
||||
return CreatePeerForElement(cell);
|
||||
}
|
||||
|
|
|
@ -14,6 +14,8 @@ using Windows.UI.Xaml.Automation.Peers;
|
|||
using Windows.UI.Xaml.Automation.Provider;
|
||||
using Windows.UI.Xaml.Data;
|
||||
|
||||
using DiagnosticsDebug = System.Diagnostics.Debug;
|
||||
|
||||
namespace Microsoft.Toolkit.Uwp.UI.Automation.Peers
|
||||
{
|
||||
/// <summary>
|
||||
|
@ -467,8 +469,8 @@ namespace Microsoft.Toolkit.Uwp.UI.Automation.Peers
|
|||
{
|
||||
// Adjust the row index to be relative to the DataGrid instead of the group
|
||||
row = groupInfo.Slot - this.OwningDataGrid.RowGroupHeadersTable.GetIndexCount(0, groupInfo.Slot) + row + 1;
|
||||
Debug.Assert(row >= 0, "Expected positive row.");
|
||||
Debug.Assert(row < this.OwningDataGrid.DataConnection.Count, "Expected row smaller than this.OwningDataGrid.DataConnection.Count.");
|
||||
DiagnosticsDebug.Assert(row >= 0, "Expected positive row.");
|
||||
DiagnosticsDebug.Assert(row < this.OwningDataGrid.DataConnection.Count, "Expected row smaller than this.OwningDataGrid.DataConnection.Count.");
|
||||
int slot = this.OwningDataGrid.SlotFromRowIndex(row);
|
||||
|
||||
if (!this.OwningDataGrid.IsSlotVisible(slot))
|
||||
|
@ -477,12 +479,12 @@ namespace Microsoft.Toolkit.Uwp.UI.Automation.Peers
|
|||
this.OwningDataGrid.ScrollIntoView(item, this.OwningDataGrid.Columns[column]);
|
||||
}
|
||||
|
||||
Debug.Assert(this.OwningDataGrid.IsSlotVisible(slot), "Expected OwningDataGrid.IsSlotVisible(slot) is true.");
|
||||
DiagnosticsDebug.Assert(this.OwningDataGrid.IsSlotVisible(slot), "Expected OwningDataGrid.IsSlotVisible(slot) is true.");
|
||||
|
||||
DataGridRow dgr = this.OwningDataGrid.DisplayData.GetDisplayedElement(slot) as DataGridRow;
|
||||
|
||||
// the first cell is always the indentation filler cell if grouping is enabled, so skip it
|
||||
Debug.Assert(column + 1 < dgr.Cells.Count, "Expected column + 1 smaller than dgr.Cells.Count.");
|
||||
DiagnosticsDebug.Assert(column + 1 < dgr.Cells.Count, "Expected column + 1 smaller than dgr.Cells.Count.");
|
||||
DataGridCell cell = dgr.Cells[column + 1];
|
||||
AutomationPeer peer = CreatePeerForElement(cell);
|
||||
if (peer != null)
|
||||
|
|
|
@ -34,6 +34,8 @@ using Windows.UI.Xaml.Input;
|
|||
using Windows.UI.Xaml.Media;
|
||||
using Windows.UI.Xaml.Media.Animation;
|
||||
|
||||
using DiagnosticsDebug = System.Diagnostics.Debug;
|
||||
|
||||
namespace Microsoft.Toolkit.Uwp.UI.Controls
|
||||
{
|
||||
/// <summary>
|
||||
|
@ -1422,7 +1424,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
DataGrid dataGrid = d as DataGrid;
|
||||
if (!dataGrid.IsHandlerSuspended(e.Property))
|
||||
{
|
||||
Debug.Assert(dataGrid.DataConnection != null, "Expected non-null DataConnection.");
|
||||
DiagnosticsDebug.Assert(dataGrid.DataConnection != null, "Expected non-null DataConnection.");
|
||||
|
||||
if (dataGrid.LoadingOrUnloadingRow)
|
||||
{
|
||||
|
@ -2221,7 +2223,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
return null;
|
||||
}
|
||||
|
||||
Debug.Assert(this.CurrentColumnIndex < this.ColumnsItemsInternal.Count, "Expected CurrentColumnIndex smaller than ColumnsItemsInternal.Count.");
|
||||
DiagnosticsDebug.Assert(this.CurrentColumnIndex < this.ColumnsItemsInternal.Count, "Expected CurrentColumnIndex smaller than ColumnsItemsInternal.Count.");
|
||||
return this.ColumnsItemsInternal[this.CurrentColumnIndex];
|
||||
}
|
||||
|
||||
|
@ -2266,7 +2268,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
}
|
||||
|
||||
this.UpdateSelectionAndCurrency(dataGridColumn.Index, this.CurrentSlot, DataGridSelectionAction.None, false /*scrollIntoView*/);
|
||||
Debug.Assert(_successfullyUpdatedSelection, "Expected _successfullyUpdatedSelection is true.");
|
||||
DiagnosticsDebug.Assert(_successfullyUpdatedSelection, "Expected _successfullyUpdatedSelection is true.");
|
||||
if (beginEdit &&
|
||||
_editingColumnIndex == -1 &&
|
||||
this.CurrentSlot != -1 &&
|
||||
|
@ -2494,7 +2496,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
|
||||
set
|
||||
{
|
||||
Debug.Assert(!value || (this.ColumnHeaders != null && this.AreColumnHeadersVisible), "Expected value==False || (non-null ColumnHeaders and AreColumnHeadersVisible==True)");
|
||||
DiagnosticsDebug.Assert(!value || (this.ColumnHeaders != null && this.AreColumnHeadersVisible), "Expected value==False || (non-null ColumnHeaders and AreColumnHeadersVisible==True)");
|
||||
|
||||
if (_columnHeaderHasFocus != value)
|
||||
{
|
||||
|
@ -2717,7 +2719,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
|
||||
set
|
||||
{
|
||||
Debug.Assert(value >= 0, "Expected positive NoCurrentCellChangeCount.");
|
||||
DiagnosticsDebug.Assert(value >= 0, "Expected positive NoCurrentCellChangeCount.");
|
||||
_noCurrentCellChangeCount = value;
|
||||
if (value == 0)
|
||||
{
|
||||
|
@ -3056,7 +3058,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
|
||||
set
|
||||
{
|
||||
Debug.Assert(value >= 0, "Expected positive NoSelectionChangeCount.");
|
||||
DiagnosticsDebug.Assert(value >= 0, "Expected positive NoSelectionChangeCount.");
|
||||
_noSelectionChangeCount = value;
|
||||
if (value == 0)
|
||||
{
|
||||
|
@ -3086,11 +3088,11 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
return false;
|
||||
}
|
||||
|
||||
Debug.Assert(this.CurrentColumnIndex >= 0, "Expected positive CurrentColumnIndex.");
|
||||
Debug.Assert(this.CurrentColumnIndex < this.ColumnsItemsInternal.Count, "Expected CurrentColumnIndex smaller than ColumnsItemsInternal.Count.");
|
||||
Debug.Assert(this.CurrentSlot >= -1, "Expected CurrentSlot greater than or equal to -1.");
|
||||
Debug.Assert(this.CurrentSlot < this.SlotCount, "Expected CurrentSlot smaller than SlotCount.");
|
||||
Debug.Assert(this.EditingRow == null || this.EditingRow.Slot == this.CurrentSlot, "Expected null EditingRow or EditingRow.Slot equal to CurrentSlot.");
|
||||
DiagnosticsDebug.Assert(this.CurrentColumnIndex >= 0, "Expected positive CurrentColumnIndex.");
|
||||
DiagnosticsDebug.Assert(this.CurrentColumnIndex < this.ColumnsItemsInternal.Count, "Expected CurrentColumnIndex smaller than ColumnsItemsInternal.Count.");
|
||||
DiagnosticsDebug.Assert(this.CurrentSlot >= -1, "Expected CurrentSlot greater than or equal to -1.");
|
||||
DiagnosticsDebug.Assert(this.CurrentSlot < this.SlotCount, "Expected CurrentSlot smaller than SlotCount.");
|
||||
DiagnosticsDebug.Assert(this.EditingRow == null || this.EditingRow.Slot == this.CurrentSlot, "Expected null EditingRow or EditingRow.Slot equal to CurrentSlot.");
|
||||
|
||||
if (GetColumnEffectiveReadOnlyState(this.CurrentColumn))
|
||||
{
|
||||
|
@ -3237,7 +3239,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
else
|
||||
{
|
||||
rowGroupInfo = this.RowGroupHeadersTable.GetValueAt(this.RowGroupHeadersTable.GetPreviousIndex(slot));
|
||||
Debug.Assert(rowGroupInfo != null, "Expected non-null rowGroupInfo.");
|
||||
DiagnosticsDebug.Assert(rowGroupInfo != null, "Expected non-null rowGroupInfo.");
|
||||
if (rowGroupInfo != null)
|
||||
{
|
||||
ExpandRowGroupParentChain(rowGroupInfo.Level, rowGroupInfo.Slot);
|
||||
|
@ -3474,7 +3476,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
_validationSummary.SelectionChanged += new EventHandler<SelectionChangedEventArgs>(ValidationSummary_SelectionChanged);
|
||||
if (Windows.ApplicationModel.DesignMode.DesignModeEnabled)
|
||||
{
|
||||
Debug.Assert(_validationSummary.Errors != null);
|
||||
DiagnosticsDebug.Assert(_validationSummary.Errors != null);
|
||||
|
||||
// Do not add the default design time errors when in design mode.
|
||||
_validationSummary.Errors.Clear();
|
||||
|
@ -3645,7 +3647,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
EventHandler<DataGridRowEventArgs> handler = this.LoadingRow;
|
||||
if (handler != null)
|
||||
{
|
||||
Debug.Assert(!_loadedRows.Contains(e.Row), "Expected e.Rows not contained in _loadedRows.");
|
||||
DiagnosticsDebug.Assert(!_loadedRows.Contains(e.Row), "Expected e.Rows not contained in _loadedRows.");
|
||||
_loadedRows.Add(e.Row);
|
||||
this.LoadingOrUnloadingRow = true;
|
||||
try
|
||||
|
@ -3655,7 +3657,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
finally
|
||||
{
|
||||
this.LoadingOrUnloadingRow = false;
|
||||
Debug.Assert(_loadedRows.Contains(e.Row), "Expected e.Rows contained in _loadedRows.");
|
||||
DiagnosticsDebug.Assert(_loadedRows.Contains(e.Row), "Expected e.Rows contained in _loadedRows.");
|
||||
_loadedRows.Remove(e.Row);
|
||||
}
|
||||
}
|
||||
|
@ -3872,7 +3874,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
|
||||
internal static DataGridCell GetOwningCell(FrameworkElement element)
|
||||
{
|
||||
Debug.Assert(element != null, "Expected non-null element.");
|
||||
DiagnosticsDebug.Assert(element != null, "Expected non-null element.");
|
||||
DataGridCell cell = element as DataGridCell;
|
||||
while (element != null && cell == null)
|
||||
{
|
||||
|
@ -4105,7 +4107,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
{
|
||||
if (scrollBarValueDifference != 0)
|
||||
{
|
||||
Debug.Assert(_horizontalOffset + scrollBarValueDifference >= 0, "Expected positive _horizontalOffset + scrollBarValueDifference.");
|
||||
DiagnosticsDebug.Assert(_horizontalOffset + scrollBarValueDifference >= 0, "Expected positive _horizontalOffset + scrollBarValueDifference.");
|
||||
SetHorizontalOffset(_horizontalOffset + scrollBarValueDifference);
|
||||
}
|
||||
|
||||
|
@ -4350,12 +4352,12 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
return;
|
||||
}
|
||||
|
||||
Debug.Assert(DoubleUtil.LessThanOrClose(_vScrollBar.Value, _vScrollBar.Maximum), "Expected _vScrollBar.Value smaller than or close to _vScrollBar.Maximum.");
|
||||
DiagnosticsDebug.Assert(DoubleUtil.LessThanOrClose(_vScrollBar.Value, _vScrollBar.Maximum), "Expected _vScrollBar.Value smaller than or close to _vScrollBar.Maximum.");
|
||||
|
||||
_verticalScrollChangesIgnored++;
|
||||
try
|
||||
{
|
||||
Debug.Assert(_vScrollBar != null, "Expected non-null _vScrollBar.");
|
||||
DiagnosticsDebug.Assert(_vScrollBar != null, "Expected non-null _vScrollBar.");
|
||||
if (scrollEventType == ScrollEventType.SmallIncrement)
|
||||
{
|
||||
this.DisplayData.PendingVerticalScrollHeight = GetVerticalSmallScrollIncrease();
|
||||
|
@ -4486,16 +4488,16 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
|
||||
internal bool ScrollSlotIntoView(int columnIndex, int slot, bool forCurrentCellChange, bool forceHorizontalScroll)
|
||||
{
|
||||
Debug.Assert(columnIndex >= 0, "Expected positive columnIndex.");
|
||||
Debug.Assert(columnIndex < this.ColumnsItemsInternal.Count, "Expected columnIndex smaller than ColumnsItemsInternal.Count.");
|
||||
Debug.Assert(this.DisplayData.FirstDisplayedScrollingCol >= -1, "Expected DisplayData.FirstDisplayedScrollingCol greater than or equal to -1.");
|
||||
Debug.Assert(this.DisplayData.FirstDisplayedScrollingCol < this.ColumnsItemsInternal.Count, "Expected smaller than ColumnsItemsInternal.Count.");
|
||||
Debug.Assert(this.DisplayData.LastTotallyDisplayedScrollingCol >= -1, "Expected DisplayData.LastTotallyDisplayedScrollingCol greater than or equal to -1.");
|
||||
Debug.Assert(this.DisplayData.LastTotallyDisplayedScrollingCol < this.ColumnsItemsInternal.Count, "Expected DisplayData.LastTotallyDisplayedScrollingCol smaller than ColumnsItemsInternal.Count.");
|
||||
Debug.Assert(!IsSlotOutOfBounds(slot), "Expected IsSlotOutOfBounds(slot) is false.");
|
||||
Debug.Assert(this.DisplayData.FirstScrollingSlot >= -1, "Expected DisplayData.FirstScrollingSlot greater than or equal to -1.");
|
||||
Debug.Assert(this.DisplayData.FirstScrollingSlot < this.SlotCount, "Expected DisplayData.FirstScrollingSlot smaller than SlotCount.");
|
||||
Debug.Assert(this.ColumnsItemsInternal[columnIndex].IsVisible, "Expected ColumnsItemsInternal[columnIndex].IsVisible is true.");
|
||||
DiagnosticsDebug.Assert(columnIndex >= 0, "Expected positive columnIndex.");
|
||||
DiagnosticsDebug.Assert(columnIndex < this.ColumnsItemsInternal.Count, "Expected columnIndex smaller than ColumnsItemsInternal.Count.");
|
||||
DiagnosticsDebug.Assert(this.DisplayData.FirstDisplayedScrollingCol >= -1, "Expected DisplayData.FirstDisplayedScrollingCol greater than or equal to -1.");
|
||||
DiagnosticsDebug.Assert(this.DisplayData.FirstDisplayedScrollingCol < this.ColumnsItemsInternal.Count, "Expected smaller than ColumnsItemsInternal.Count.");
|
||||
DiagnosticsDebug.Assert(this.DisplayData.LastTotallyDisplayedScrollingCol >= -1, "Expected DisplayData.LastTotallyDisplayedScrollingCol greater than or equal to -1.");
|
||||
DiagnosticsDebug.Assert(this.DisplayData.LastTotallyDisplayedScrollingCol < this.ColumnsItemsInternal.Count, "Expected DisplayData.LastTotallyDisplayedScrollingCol smaller than ColumnsItemsInternal.Count.");
|
||||
DiagnosticsDebug.Assert(!IsSlotOutOfBounds(slot), "Expected IsSlotOutOfBounds(slot) is false.");
|
||||
DiagnosticsDebug.Assert(this.DisplayData.FirstScrollingSlot >= -1, "Expected DisplayData.FirstScrollingSlot greater than or equal to -1.");
|
||||
DiagnosticsDebug.Assert(this.DisplayData.FirstScrollingSlot < this.SlotCount, "Expected DisplayData.FirstScrollingSlot smaller than SlotCount.");
|
||||
DiagnosticsDebug.Assert(this.ColumnsItemsInternal[columnIndex].IsVisible, "Expected ColumnsItemsInternal[columnIndex].IsVisible is true.");
|
||||
|
||||
if (this.CurrentColumnIndex >= 0 &&
|
||||
(this.CurrentColumnIndex != columnIndex || this.CurrentSlot != slot))
|
||||
|
@ -4705,7 +4707,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
FrameworkElement editingElement = editingColumn.GetCellContent(this.EditingRow);
|
||||
if (editingElement != null && editingElement.ContainsChild(_focusedObject))
|
||||
{
|
||||
Debug.Assert(_lostFocusActions != null, "Expected non-null _lostFocusActions.");
|
||||
DiagnosticsDebug.Assert(_lostFocusActions != null, "Expected non-null _lostFocusActions.");
|
||||
_lostFocusActions.Enqueue(action);
|
||||
editingElement.LostFocus += new RoutedEventHandler(EditingElement_LostFocus);
|
||||
this.IsTabStop = true;
|
||||
|
@ -4720,7 +4722,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
// Applies the given Style to the Row if it's supposed to use DataGrid.RowStyle
|
||||
private static void EnsureElementStyle(FrameworkElement element, Style oldDataGridStyle, Style newDataGridStyle)
|
||||
{
|
||||
Debug.Assert(element != null, "Expected non-null element.");
|
||||
DiagnosticsDebug.Assert(element != null, "Expected non-null element.");
|
||||
|
||||
// Apply the DataGrid style if the row was using the old DataGridRowStyle before
|
||||
if (element != null && (element.Style == null || element.Style == oldDataGridStyle))
|
||||
|
@ -4814,18 +4816,18 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
return false;
|
||||
}
|
||||
|
||||
Debug.Assert(this.CurrentColumnIndex >= 0, "Expected positive CurrentColumnIndex.");
|
||||
Debug.Assert(this.CurrentColumnIndex < this.ColumnsItemsInternal.Count, "Expected CurrentColumnIndex smaller than ColumnsItemsInternal.Count.");
|
||||
Debug.Assert(this.CurrentSlot >= -1, "Expected CurrentSlot greater than or equal to -1.");
|
||||
Debug.Assert(this.CurrentSlot < this.SlotCount, "Expected CurrentSlot smaller than SlotCount.");
|
||||
Debug.Assert(this.EditingRow == null || this.EditingRow.Slot == this.CurrentSlot, "Expected null EditingRow or EditingRow.Slot equal to CurrentSlot.");
|
||||
Debug.Assert(!GetColumnEffectiveReadOnlyState(this.CurrentColumn), "Expected GetColumnEffectiveReadOnlyState(CurrentColumn) is false.");
|
||||
Debug.Assert(this.CurrentColumn.IsVisible, "Expected CurrentColumn.IsVisible is true.");
|
||||
DiagnosticsDebug.Assert(this.CurrentColumnIndex >= 0, "Expected positive CurrentColumnIndex.");
|
||||
DiagnosticsDebug.Assert(this.CurrentColumnIndex < this.ColumnsItemsInternal.Count, "Expected CurrentColumnIndex smaller than ColumnsItemsInternal.Count.");
|
||||
DiagnosticsDebug.Assert(this.CurrentSlot >= -1, "Expected CurrentSlot greater than or equal to -1.");
|
||||
DiagnosticsDebug.Assert(this.CurrentSlot < this.SlotCount, "Expected CurrentSlot smaller than SlotCount.");
|
||||
DiagnosticsDebug.Assert(this.EditingRow == null || this.EditingRow.Slot == this.CurrentSlot, "Expected null EditingRow or EditingRow.Slot equal to CurrentSlot.");
|
||||
DiagnosticsDebug.Assert(!GetColumnEffectiveReadOnlyState(this.CurrentColumn), "Expected GetColumnEffectiveReadOnlyState(CurrentColumn) is false.");
|
||||
DiagnosticsDebug.Assert(this.CurrentColumn.IsVisible, "Expected CurrentColumn.IsVisible is true.");
|
||||
|
||||
if (_editingColumnIndex != -1)
|
||||
{
|
||||
// Current cell is already in edit mode
|
||||
Debug.Assert(_editingColumnIndex == this.CurrentColumnIndex, "Expected _editingColumnIndex equals CurrentColumnIndex.");
|
||||
DiagnosticsDebug.Assert(_editingColumnIndex == this.CurrentColumnIndex, "Expected _editingColumnIndex equals CurrentColumnIndex.");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -4839,12 +4841,12 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
DataGridRow dataGridRow = this.EditingRow;
|
||||
if (dataGridRow == null)
|
||||
{
|
||||
Debug.Assert(!this.RowGroupHeadersTable.Contains(this.CurrentSlot), "Expected CurrentSlot not contained in RowGroupHeadersTable.");
|
||||
DiagnosticsDebug.Assert(!this.RowGroupHeadersTable.Contains(this.CurrentSlot), "Expected CurrentSlot not contained in RowGroupHeadersTable.");
|
||||
|
||||
if (this.IsSlotVisible(this.CurrentSlot))
|
||||
{
|
||||
dataGridRow = this.DisplayData.GetDisplayedElement(this.CurrentSlot) as DataGridRow;
|
||||
Debug.Assert(dataGridRow != null, "Expected non-null dataGridRow.");
|
||||
DiagnosticsDebug.Assert(dataGridRow != null, "Expected non-null dataGridRow.");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -4860,7 +4862,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
}
|
||||
}
|
||||
|
||||
Debug.Assert(dataGridRow != null, "Expected non-null dataGridRow.");
|
||||
DiagnosticsDebug.Assert(dataGridRow != null, "Expected non-null dataGridRow.");
|
||||
|
||||
// Cache these to see if they change later
|
||||
int currentRowIndex = this.CurrentSlot;
|
||||
|
@ -4898,11 +4900,11 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
|
||||
private bool BeginRowEdit(DataGridRow dataGridRow)
|
||||
{
|
||||
Debug.Assert(this.EditingRow == null, "Expected non-null EditingRow.");
|
||||
Debug.Assert(dataGridRow != null, "Expected non-null dataGridRow.");
|
||||
DiagnosticsDebug.Assert(this.EditingRow == null, "Expected non-null EditingRow.");
|
||||
DiagnosticsDebug.Assert(dataGridRow != null, "Expected non-null dataGridRow.");
|
||||
|
||||
Debug.Assert(this.CurrentSlot >= -1, "Expected CurrentSlot greater than or equal to -1.");
|
||||
Debug.Assert(this.CurrentSlot < this.SlotCount, "Expected CurrentSlot smaller than SlotCount.");
|
||||
DiagnosticsDebug.Assert(this.CurrentSlot >= -1, "Expected CurrentSlot greater than or equal to -1.");
|
||||
DiagnosticsDebug.Assert(this.CurrentSlot < this.SlotCount, "Expected CurrentSlot smaller than SlotCount.");
|
||||
|
||||
if (this.DataConnection.BeginEdit(dataGridRow.DataContext))
|
||||
{
|
||||
|
@ -4930,10 +4932,10 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
return true;
|
||||
}
|
||||
|
||||
Debug.Assert(this.EditingRow != null, "Expected non-null EditingRow.");
|
||||
Debug.Assert(this.EditingRow.Index >= -1, "Expected EditingRow greater or equal to -1.");
|
||||
Debug.Assert(this.EditingRow.Slot < this.SlotCount, "Expected EditingRow smaller than SlotCount.");
|
||||
Debug.Assert(this.CurrentColumn != null, "Expected non-null CurrentColumn.");
|
||||
DiagnosticsDebug.Assert(this.EditingRow != null, "Expected non-null EditingRow.");
|
||||
DiagnosticsDebug.Assert(this.EditingRow.Index >= -1, "Expected EditingRow greater or equal to -1.");
|
||||
DiagnosticsDebug.Assert(this.EditingRow.Slot < this.SlotCount, "Expected EditingRow smaller than SlotCount.");
|
||||
DiagnosticsDebug.Assert(this.CurrentColumn != null, "Expected non-null CurrentColumn.");
|
||||
|
||||
object dataItem = this.EditingRow.DataContext;
|
||||
if (!this.DataConnection.CancelEdit(dataItem))
|
||||
|
@ -5003,9 +5005,9 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
return true;
|
||||
}
|
||||
|
||||
Debug.Assert(this.EditingRow != null, "Expected non-null EditingRow.");
|
||||
Debug.Assert(this.EditingRow.Index >= -1, "Expected EditingRow.Index greater than or equal to -1.");
|
||||
Debug.Assert(this.EditingRow.Slot < this.SlotCount, "Expected EditingRow.Slot smaller than SlotCount.");
|
||||
DiagnosticsDebug.Assert(this.EditingRow != null, "Expected non-null EditingRow.");
|
||||
DiagnosticsDebug.Assert(this.EditingRow.Index >= -1, "Expected EditingRow.Index greater than or equal to -1.");
|
||||
DiagnosticsDebug.Assert(this.EditingRow.Slot < this.SlotCount, "Expected EditingRow.Slot smaller than SlotCount.");
|
||||
|
||||
if (!ValidateEditingRow(true /*scrollIntoView*/, false /*wireEvents*/))
|
||||
{
|
||||
|
@ -5024,7 +5026,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
|
||||
private void CompleteCellsCollection(DataGridRow dataGridRow)
|
||||
{
|
||||
Debug.Assert(dataGridRow != null, "Expected non-null dataGridRow.");
|
||||
DiagnosticsDebug.Assert(dataGridRow != null, "Expected non-null dataGridRow.");
|
||||
int cellsInCollection = dataGridRow.Cells.Count;
|
||||
if (this.ColumnsItemsInternal.Count > cellsInCollection)
|
||||
{
|
||||
|
@ -5125,7 +5127,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
{
|
||||
double oldDataHeight = cellsHeight;
|
||||
cellsHeight -= horizScrollBarHeight;
|
||||
Debug.Assert(cellsHeight >= 0, "Expected positive cellsHeight.");
|
||||
DiagnosticsDebug.Assert(cellsHeight >= 0, "Expected positive cellsHeight.");
|
||||
needHorizScrollBarWithoutVertScrollBar = needHorizScrollBar = true;
|
||||
|
||||
if (vertScrollBarWidth > 0 &&
|
||||
|
@ -5159,7 +5161,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
this.DisplayData.NumTotallyDisplayedScrollingElements != this.VisibleSlotCount)
|
||||
{
|
||||
cellsWidth -= vertScrollBarWidth;
|
||||
Debug.Assert(cellsWidth >= 0, "Expected positive cellsWidth.");
|
||||
DiagnosticsDebug.Assert(cellsWidth >= 0, "Expected positive cellsWidth.");
|
||||
needVertScrollBar = true;
|
||||
}
|
||||
|
||||
|
@ -5177,7 +5179,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
{
|
||||
cellsWidth += vertScrollBarWidth;
|
||||
cellsHeight -= horizScrollBarHeight;
|
||||
Debug.Assert(cellsHeight >= 0, "Expected positive cellsHeight.");
|
||||
DiagnosticsDebug.Assert(cellsHeight >= 0, "Expected positive cellsHeight.");
|
||||
needVertScrollBar = false;
|
||||
|
||||
UpdateDisplayedRows(firstScrollingSlot, cellsHeight);
|
||||
|
@ -5186,7 +5188,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
this.DisplayData.NumTotallyDisplayedScrollingElements != this.VisibleSlotCount)
|
||||
{
|
||||
cellsWidth -= vertScrollBarWidth;
|
||||
Debug.Assert(cellsWidth >= 0, "Expected positive cellsWidth.");
|
||||
DiagnosticsDebug.Assert(cellsWidth >= 0, "Expected positive cellsWidth.");
|
||||
needVertScrollBar = true;
|
||||
}
|
||||
|
||||
|
@ -5209,7 +5211,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
this.DisplayData.NumTotallyDisplayedScrollingElements != this.VisibleSlotCount)
|
||||
{
|
||||
cellsWidth -= vertScrollBarWidth;
|
||||
Debug.Assert(cellsWidth >= 0, "Expected positive cellsWidth.");
|
||||
DiagnosticsDebug.Assert(cellsWidth >= 0, "Expected positive cellsWidth.");
|
||||
needVertScrollBar = true;
|
||||
}
|
||||
|
||||
|
@ -5229,7 +5231,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
DoubleUtil.LessThan(totalVisibleFrozenWidth, cellsWidth))
|
||||
{
|
||||
cellsHeight -= horizScrollBarHeight;
|
||||
Debug.Assert(cellsHeight >= 0, "Expected positive cellsHeight.");
|
||||
DiagnosticsDebug.Assert(cellsHeight >= 0, "Expected positive cellsHeight.");
|
||||
needHorizScrollBar = true;
|
||||
UpdateDisplayedRows(this.DisplayData.FirstScrollingSlot, cellsHeight);
|
||||
}
|
||||
|
@ -5242,10 +5244,10 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
}
|
||||
else
|
||||
{
|
||||
Debug.Assert(forceHorizScrollBar, "Expected forceHorizScrollBar is true.");
|
||||
Debug.Assert(forceVertScrollBar, "Expected forceVertScrollBar is true.");
|
||||
Debug.Assert(allowHorizScrollBar, "Expected allowHorizScrollBar is true.");
|
||||
Debug.Assert(allowVertScrollBar, "Expected allowVertScrollBar is true.");
|
||||
DiagnosticsDebug.Assert(forceHorizScrollBar, "Expected forceHorizScrollBar is true.");
|
||||
DiagnosticsDebug.Assert(forceVertScrollBar, "Expected forceVertScrollBar is true.");
|
||||
DiagnosticsDebug.Assert(allowHorizScrollBar, "Expected allowHorizScrollBar is true.");
|
||||
DiagnosticsDebug.Assert(allowVertScrollBar, "Expected allowVertScrollBar is true.");
|
||||
this.DisplayData.FirstDisplayedScrollingCol = ComputeFirstVisibleScrollingColumn();
|
||||
ComputeDisplayedColumns();
|
||||
needVertScrollBar = this.DisplayData.NumTotallyDisplayedScrollingElements != this.VisibleSlotCount;
|
||||
|
@ -5290,9 +5292,9 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
/// <returns>ValidationSummaryItem</returns>
|
||||
private ValidationSummaryItem CreateValidationSummaryItem(ValidationResult validationResult)
|
||||
{
|
||||
Debug.Assert(validationResult != null);
|
||||
Debug.Assert(_validationSummary != null);
|
||||
Debug.Assert(this.EditingRow != null, "Expected non-null EditingRow.");
|
||||
DiagnosticsDebug.Assert(validationResult != null);
|
||||
DiagnosticsDebug.Assert(_validationSummary != null);
|
||||
DiagnosticsDebug.Assert(this.EditingRow != null, "Expected non-null EditingRow.");
|
||||
|
||||
ValidationSummaryItem validationSummaryItem = new ValidationSummaryItem(validationResult.ErrorMessage);
|
||||
validationSummaryItem.Context = validationResult;
|
||||
|
@ -5313,7 +5315,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
}
|
||||
}
|
||||
|
||||
Debug.Assert(validationSummaryItem.ItemType == ValidationSummaryItemType.ObjectError);
|
||||
DiagnosticsDebug.Assert(validationSummaryItem.ItemType == ValidationSummaryItemType.ObjectError);
|
||||
if (_propertyValidationResults.ContainsEqualValidationResult(validationResult))
|
||||
{
|
||||
validationSummaryItem.MessageHeader = messageHeader;
|
||||
|
@ -5341,7 +5343,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
this.FocusEditingCell(true);
|
||||
}
|
||||
|
||||
Debug.Assert(_lostFocusActions != null, "Expected non-null _lostFocusActions.");
|
||||
DiagnosticsDebug.Assert(_lostFocusActions != null, "Expected non-null _lostFocusActions.");
|
||||
try
|
||||
{
|
||||
_executingLostFocusActions = true;
|
||||
|
@ -5462,7 +5464,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
/// <param name="e">FocusingInvalidControlEventArgs</param>
|
||||
private void ValidationSummary_FocusingInvalidControl(object sender, FocusingInvalidControlEventArgs e)
|
||||
{
|
||||
Debug.Assert(_validationSummary != null);
|
||||
DiagnosticsDebug.Assert(_validationSummary != null);
|
||||
if (this.EditingRow == null || this.IsSlotOutOfBounds(this.EditingRow.Slot) || this.EditingRow.Slot == -1 || !ScrollSlotIntoView(this.EditingRow.Slot, false /*scrolledHorizontally*/))
|
||||
{
|
||||
return;
|
||||
|
@ -5475,7 +5477,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
DataGridCell cell = e.Target.Control as DataGridCell;
|
||||
if (cell != null && cell.OwningGrid == this && cell.OwningColumn != null && cell.OwningColumn.IsVisible)
|
||||
{
|
||||
Debug.Assert(cell.ColumnIndex >= 0 && cell.ColumnIndex < this.ColumnsInternal.Count);
|
||||
DiagnosticsDebug.Assert(cell.ColumnIndex >= 0 && cell.ColumnIndex < this.ColumnsInternal.Count);
|
||||
|
||||
// Begin editing the next relevant cell
|
||||
UpdateSelectionAndCurrency(cell.ColumnIndex, this.EditingRow.Slot, DataGridSelectionAction.None, true /*scrollIntoView*/);
|
||||
|
@ -5522,7 +5524,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
while (previousHeaderSlot >= 0)
|
||||
{
|
||||
DataGridRowGroupInfo rowGroupInfo = this.RowGroupHeadersTable.GetValueAt(previousHeaderSlot);
|
||||
Debug.Assert(rowGroupInfo != null, "Expected non-null rowGroupInfo.");
|
||||
DiagnosticsDebug.Assert(rowGroupInfo != null, "Expected non-null rowGroupInfo.");
|
||||
if (level == rowGroupInfo.Level)
|
||||
{
|
||||
if (_collapsedSlotsTable.Contains(rowGroupInfo.Slot))
|
||||
|
@ -5554,8 +5556,8 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
/// <returns>ValidationSummaryItem or null if not found</returns>
|
||||
private ValidationSummaryItem FindValidationSummaryItem(ValidationResult context)
|
||||
{
|
||||
Debug.Assert(context != null);
|
||||
Debug.Assert(_validationSummary != null);
|
||||
DiagnosticsDebug.Assert(context != null);
|
||||
DiagnosticsDebug.Assert(_validationSummary != null);
|
||||
foreach (ValidationSummaryItem ValidationSummaryItem in _validationSummary.Errors)
|
||||
{
|
||||
if (context.Equals(ValidationSummaryItem.Context))
|
||||
|
@ -5703,7 +5705,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
|
||||
if (shift && this.LastHandledKeyDown != VirtualKey.Tab)
|
||||
{
|
||||
Debug.Assert(!this.ColumnHeaderHasFocus, "Expected ColumnHeaderHasFocus is false.");
|
||||
DiagnosticsDebug.Assert(!this.ColumnHeaderHasFocus, "Expected ColumnHeaderHasFocus is false.");
|
||||
|
||||
// Show currency on the current column's header as focus is entering the DataGrid backwards.
|
||||
this.ColumnHeaderHasFocus = true;
|
||||
|
@ -5711,7 +5713,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
}
|
||||
|
||||
bool success = ScrollSlotIntoView(this.CurrentColumnIndex, this.CurrentSlot, false /*forCurrentCellChange*/, true /*forceHorizontalScroll*/);
|
||||
Debug.Assert(success, "Expected ScrollSlotIntoView returns true.");
|
||||
DiagnosticsDebug.Assert(success, "Expected ScrollSlotIntoView returns true.");
|
||||
if (this.CurrentColumnIndex != -1 && this.SelectedItem == null)
|
||||
{
|
||||
SetRowSelection(this.CurrentSlot, true /*isSelected*/, true /*setAnchorSlot*/);
|
||||
|
@ -5908,11 +5910,11 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
return true;
|
||||
}
|
||||
|
||||
Debug.Assert(this.EditingRow != null, "Expected non-null EditingRow.");
|
||||
Debug.Assert(this.EditingRow.Slot == this.CurrentSlot, "Expected EditingRow.Slot equals CurrentSlot.");
|
||||
Debug.Assert(_editingColumnIndex >= 0, "Expected positive _editingColumnIndex.");
|
||||
Debug.Assert(_editingColumnIndex < this.ColumnsItemsInternal.Count, "Expected _editingColumnIndex smaller than this.ColumnsItemsInternal.Count.");
|
||||
Debug.Assert(_editingColumnIndex == this.CurrentColumnIndex, "Expected _editingColumnIndex equals this.CurrentColumnIndex.");
|
||||
DiagnosticsDebug.Assert(this.EditingRow != null, "Expected non-null EditingRow.");
|
||||
DiagnosticsDebug.Assert(this.EditingRow.Slot == this.CurrentSlot, "Expected EditingRow.Slot equals CurrentSlot.");
|
||||
DiagnosticsDebug.Assert(_editingColumnIndex >= 0, "Expected positive _editingColumnIndex.");
|
||||
DiagnosticsDebug.Assert(_editingColumnIndex < this.ColumnsItemsInternal.Count, "Expected _editingColumnIndex smaller than this.ColumnsItemsInternal.Count.");
|
||||
DiagnosticsDebug.Assert(_editingColumnIndex == this.CurrentColumnIndex, "Expected _editingColumnIndex equals this.CurrentColumnIndex.");
|
||||
|
||||
// Cache these to see if they change later
|
||||
int currentSlot = this.CurrentSlot;
|
||||
|
@ -5944,10 +5946,10 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
return true;
|
||||
}
|
||||
|
||||
Debug.Assert(this.EditingRow != null, "Expected non-null EditingRow.");
|
||||
Debug.Assert(this.EditingRow.Slot == currentSlot, "Expected EditingRow.Slot equals currentSlot.");
|
||||
Debug.Assert(_editingColumnIndex != -1, "Expected _editingColumnIndex other than -1.");
|
||||
Debug.Assert(_editingColumnIndex == this.CurrentColumnIndex, "Expected _editingColumnIndex equals CurrentColumnIndex.");
|
||||
DiagnosticsDebug.Assert(this.EditingRow != null, "Expected non-null EditingRow.");
|
||||
DiagnosticsDebug.Assert(this.EditingRow.Slot == currentSlot, "Expected EditingRow.Slot equals currentSlot.");
|
||||
DiagnosticsDebug.Assert(_editingColumnIndex != -1, "Expected _editingColumnIndex other than -1.");
|
||||
DiagnosticsDebug.Assert(_editingColumnIndex == this.CurrentColumnIndex, "Expected _editingColumnIndex equals CurrentColumnIndex.");
|
||||
}
|
||||
|
||||
_bindingValidationResults.Clear();
|
||||
|
@ -5965,10 +5967,10 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
return true;
|
||||
}
|
||||
|
||||
Debug.Assert(this.EditingRow != null, "Expected non-null EditingRow.");
|
||||
Debug.Assert(this.EditingRow.Slot == currentSlot, "Expected EditingRow.Slot equals currentSlot.");
|
||||
Debug.Assert(_editingColumnIndex != -1, "Expected _editingColumnIndex other than -1.");
|
||||
Debug.Assert(_editingColumnIndex == this.CurrentColumnIndex, "Expected _editingColumnIndex equals CurrentColumnIndex.");
|
||||
DiagnosticsDebug.Assert(this.EditingRow != null, "Expected non-null EditingRow.");
|
||||
DiagnosticsDebug.Assert(this.EditingRow.Slot == currentSlot, "Expected EditingRow.Slot equals currentSlot.");
|
||||
DiagnosticsDebug.Assert(_editingColumnIndex != -1, "Expected _editingColumnIndex other than -1.");
|
||||
DiagnosticsDebug.Assert(_editingColumnIndex == this.CurrentColumnIndex, "Expected _editingColumnIndex equals CurrentColumnIndex.");
|
||||
|
||||
// Re-validate
|
||||
this.ValidateEditingRow(true /*scrollIntoView*/, false /*wireEvents*/);
|
||||
|
@ -5979,7 +5981,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
{
|
||||
foreach (BindingInfo bindingData in this.CurrentColumn.GetInputBindings(editingElement, this.CurrentItem))
|
||||
{
|
||||
Debug.Assert(bindingData.BindingExpression.ParentBinding != null, "Expected non-null bindingData.BindingExpression.ParentBinding.");
|
||||
DiagnosticsDebug.Assert(bindingData.BindingExpression.ParentBinding != null, "Expected non-null bindingData.BindingExpression.ParentBinding.");
|
||||
_updateSourcePath = bindingData.BindingExpression.ParentBinding.Path != null ? bindingData.BindingExpression.ParentBinding.Path.Path : null;
|
||||
#if FEATURE_VALIDATION
|
||||
bindingData.Element.BindingValidationError += new EventHandler<ValidationErrorEventArgs>(EditingElement_BindingValidationError);
|
||||
|
@ -6169,17 +6171,17 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
|
||||
if (this.EditingRow == null || this.DataConnection.EndingEdit)
|
||||
{
|
||||
Debug.Assert(_editingColumnIndex == -1, "Expected _editingColumnIndex equal to -1.");
|
||||
DiagnosticsDebug.Assert(_editingColumnIndex == -1, "Expected _editingColumnIndex equal to -1.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (_editingColumnIndex != -1)
|
||||
{
|
||||
Debug.Assert(this.EditingRow != null, "Expected non-null EditingRow.");
|
||||
Debug.Assert(this.EditingRow.Slot == this.CurrentSlot, "Expected EditingRow.Slot equals CurrentSlot.");
|
||||
Debug.Assert(_editingColumnIndex >= 0, "Expected positive _editingColumnIndex.");
|
||||
Debug.Assert(_editingColumnIndex < this.ColumnsItemsInternal.Count, "Expected _editingColumnIndex smaller than this.ColumnsItemsInternal.Count.");
|
||||
Debug.Assert(_editingColumnIndex == this.CurrentColumnIndex, "Expected _editingColumnIndex equals CurrentColumnIndex.");
|
||||
DiagnosticsDebug.Assert(this.EditingRow != null, "Expected non-null EditingRow.");
|
||||
DiagnosticsDebug.Assert(this.EditingRow.Slot == this.CurrentSlot, "Expected EditingRow.Slot equals CurrentSlot.");
|
||||
DiagnosticsDebug.Assert(_editingColumnIndex >= 0, "Expected positive _editingColumnIndex.");
|
||||
DiagnosticsDebug.Assert(_editingColumnIndex < this.ColumnsItemsInternal.Count, "Expected _editingColumnIndex smaller than this.ColumnsItemsInternal.Count.");
|
||||
DiagnosticsDebug.Assert(_editingColumnIndex == this.CurrentColumnIndex, "Expected _editingColumnIndex equals CurrentColumnIndex.");
|
||||
|
||||
_editingColumnIndex = -1;
|
||||
this.EditingRow.Cells[this.CurrentColumnIndex].ApplyCellState(false /*animate*/);
|
||||
|
@ -6196,7 +6198,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
if (keepFocus)
|
||||
{
|
||||
bool success = Focus(FocusState.Programmatic);
|
||||
Debug.Assert(success, "Expected successful Focus call.");
|
||||
DiagnosticsDebug.Assert(success, "Expected successful Focus call.");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6230,7 +6232,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
if (_collapsedSlotsTable.Contains(this.CurrentSlot) && this.CurrentSlot != this.SlotFromRowIndex(this.DataConnection.NewItemPlaceholderIndex))
|
||||
{
|
||||
DataGridRowGroupInfo rowGroupInfo = this.RowGroupHeadersTable.GetValueAt(this.RowGroupHeadersTable.GetPreviousIndex(this.CurrentSlot));
|
||||
Debug.Assert(rowGroupInfo != null, "Expected non-null rowGroupInfo.");
|
||||
DiagnosticsDebug.Assert(rowGroupInfo != null, "Expected non-null rowGroupInfo.");
|
||||
if (rowGroupInfo != null)
|
||||
{
|
||||
this.ExpandRowGroupParentChain(rowGroupInfo.Level, rowGroupInfo.Slot);
|
||||
|
@ -6290,13 +6292,13 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
|
||||
private bool FocusEditingCell(bool setFocus)
|
||||
{
|
||||
Debug.Assert(this.CurrentColumnIndex >= 0, "Expected positive CurrentColumnIndex.");
|
||||
Debug.Assert(this.CurrentColumnIndex < this.ColumnsItemsInternal.Count, "Expected CurrentColumnIndex smaller than ColumnsItemsInternal.Count.");
|
||||
Debug.Assert(this.CurrentSlot >= -1, "Expected CurrentSlot greater than or equal to -1.");
|
||||
Debug.Assert(this.CurrentSlot < this.SlotCount, "Expected CurrentSlot smaller than SlotCount.");
|
||||
Debug.Assert(this.EditingRow != null, "Expected non-null EditingRow.");
|
||||
Debug.Assert(this.EditingRow.Slot == this.CurrentSlot, "Expected EditingRow.Slot equals CurrentSlot.");
|
||||
Debug.Assert(_editingColumnIndex != -1, "Expected _editingColumnIndex other than -1.");
|
||||
DiagnosticsDebug.Assert(this.CurrentColumnIndex >= 0, "Expected positive CurrentColumnIndex.");
|
||||
DiagnosticsDebug.Assert(this.CurrentColumnIndex < this.ColumnsItemsInternal.Count, "Expected CurrentColumnIndex smaller than ColumnsItemsInternal.Count.");
|
||||
DiagnosticsDebug.Assert(this.CurrentSlot >= -1, "Expected CurrentSlot greater than or equal to -1.");
|
||||
DiagnosticsDebug.Assert(this.CurrentSlot < this.SlotCount, "Expected CurrentSlot smaller than SlotCount.");
|
||||
DiagnosticsDebug.Assert(this.EditingRow != null, "Expected non-null EditingRow.");
|
||||
DiagnosticsDebug.Assert(this.EditingRow.Slot == this.CurrentSlot, "Expected EditingRow.Slot equals CurrentSlot.");
|
||||
DiagnosticsDebug.Assert(_editingColumnIndex != -1, "Expected _editingColumnIndex other than -1.");
|
||||
|
||||
// TODO: Figure out if we should cache this.IsTabStop in order to restore
|
||||
// it later instead of setting it back to true unconditionally.
|
||||
|
@ -6567,8 +6569,8 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
{
|
||||
if (this.RowGroupHeadersTable.Contains(slot))
|
||||
{
|
||||
Debug.Assert(slot >= 0, "Expected positive slot.");
|
||||
Debug.Assert(slot < this.SlotCount, "Expected slot smaller than this.SlotCount.");
|
||||
DiagnosticsDebug.Assert(slot >= 0, "Expected positive slot.");
|
||||
DiagnosticsDebug.Assert(slot < this.SlotCount, "Expected slot smaller than this.SlotCount.");
|
||||
return false;
|
||||
}
|
||||
else
|
||||
|
@ -6659,7 +6661,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
|
||||
private void NoIndicatorStateStoryboard_Completed(object sender, object e)
|
||||
{
|
||||
Debug.Assert(_hasNoIndicatorStateStoryboardCompletedHandler, "Expected _hasNoIndicatorStateStoryboardCompletedHandler is true.");
|
||||
DiagnosticsDebug.Assert(_hasNoIndicatorStateStoryboardCompletedHandler, "Expected _hasNoIndicatorStateStoryboardCompletedHandler is true.");
|
||||
|
||||
_showingMouseIndicators = false;
|
||||
}
|
||||
|
@ -6670,9 +6672,9 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
DataGridRow dataGridRow,
|
||||
DataGridCell dataGridCell)
|
||||
{
|
||||
Debug.Assert(dataGridColumn != null, "Expected non-null dataGridColumn.");
|
||||
Debug.Assert(dataGridRow != null, "Expected non-null dataGridRow.");
|
||||
Debug.Assert(dataGridCell != null, "Expected non-null dataGridCell.");
|
||||
DiagnosticsDebug.Assert(dataGridColumn != null, "Expected non-null dataGridColumn.");
|
||||
DiagnosticsDebug.Assert(dataGridRow != null, "Expected non-null dataGridRow.");
|
||||
DiagnosticsDebug.Assert(dataGridCell != null, "Expected non-null dataGridCell.");
|
||||
|
||||
FrameworkElement element = null;
|
||||
DataGridBoundColumn dataGridBoundColumn = dataGridColumn as DataGridBoundColumn;
|
||||
|
@ -6737,11 +6739,11 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
return;
|
||||
}
|
||||
|
||||
Debug.Assert(this.EditingRow != null, "Expected non-null EditingRow.");
|
||||
Debug.Assert(this.EditingRow.Slot == this.CurrentSlot, "Expected EditingRow.Slot equals CurrentSlot.");
|
||||
Debug.Assert(_editingColumnIndex >= 0, "Expected positive _editingColumnIndex.");
|
||||
Debug.Assert(_editingColumnIndex < this.ColumnsItemsInternal.Count, "Expected _editingColumnIndex smaller than this.ColumnsItemsInternal.Count.");
|
||||
Debug.Assert(_editingColumnIndex == this.CurrentColumnIndex, "Expected _editingColumnIndex equals CurrentColumnIndex.");
|
||||
DiagnosticsDebug.Assert(this.EditingRow != null, "Expected non-null EditingRow.");
|
||||
DiagnosticsDebug.Assert(this.EditingRow.Slot == this.CurrentSlot, "Expected EditingRow.Slot equals CurrentSlot.");
|
||||
DiagnosticsDebug.Assert(_editingColumnIndex >= 0, "Expected positive _editingColumnIndex.");
|
||||
DiagnosticsDebug.Assert(_editingColumnIndex < this.ColumnsItemsInternal.Count, "Expected _editingColumnIndex smaller than this.ColumnsItemsInternal.Count.");
|
||||
DiagnosticsDebug.Assert(_editingColumnIndex == this.CurrentColumnIndex, "Expected _editingColumnIndex equals CurrentColumnIndex.");
|
||||
|
||||
FocusEditingCell(this.ContainsFocus || _focusEditingControl /*setFocus*/);
|
||||
|
||||
|
@ -6951,7 +6953,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
return true;
|
||||
}
|
||||
|
||||
Debug.Assert(this.CurrentColumnIndex != -1, "Expected CurrentColumnIndex other than -1.");
|
||||
DiagnosticsDebug.Assert(this.CurrentColumnIndex != -1, "Expected CurrentColumnIndex other than -1.");
|
||||
desiredSlot = this.FirstVisibleSlot;
|
||||
columnIndex = this.CurrentColumnIndex;
|
||||
action = DataGridSelectionAction.SelectCurrent;
|
||||
|
@ -7300,7 +7302,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
{
|
||||
desiredSlot = firstVisibleSlot;
|
||||
action = DataGridSelectionAction.SelectCurrent;
|
||||
Debug.Assert(_selectedItems.Count == 0, "Expected _selectedItems.Count equals 0.");
|
||||
DiagnosticsDebug.Assert(_selectedItems.Count == 0, "Expected _selectedItems.Count equals 0.");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -7373,7 +7375,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
}
|
||||
|
||||
int nextPageSlot = this.CurrentSlot == -1 ? this.DisplayData.FirstScrollingSlot : this.CurrentSlot;
|
||||
Debug.Assert(nextPageSlot != -1, "Expected nextPageSlot other than -1.");
|
||||
DiagnosticsDebug.Assert(nextPageSlot != -1, "Expected nextPageSlot other than -1.");
|
||||
int slot = GetNextVisibleSlot(nextPageSlot);
|
||||
|
||||
int scrollCount = this.DisplayData.NumTotallyDisplayedScrollingElements;
|
||||
|
@ -7427,7 +7429,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
}
|
||||
|
||||
int previousPageSlot = (this.CurrentSlot == -1) ? this.DisplayData.FirstScrollingSlot : this.CurrentSlot;
|
||||
Debug.Assert(previousPageSlot != -1, "Expected previousPageSlot other than -1.");
|
||||
DiagnosticsDebug.Assert(previousPageSlot != -1, "Expected previousPageSlot other than -1.");
|
||||
|
||||
int scrollCount = this.DisplayData.NumTotallyDisplayedScrollingElements;
|
||||
int slot = GetPreviousVisibleSlot(previousPageSlot);
|
||||
|
@ -7438,7 +7440,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
slot = GetPreviousVisibleSlot(slot);
|
||||
}
|
||||
|
||||
Debug.Assert(previousPageSlot != -1, "Expected previousPageSlot other than -1.");
|
||||
DiagnosticsDebug.Assert(previousPageSlot != -1, "Expected previousPageSlot other than -1.");
|
||||
|
||||
_noSelectionChangeCount++;
|
||||
try
|
||||
|
@ -7679,8 +7681,8 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
}
|
||||
|
||||
// Try to locate a writable cell before/after the current cell
|
||||
Debug.Assert(this.CurrentColumnIndex != -1, "Expected CurrentColumnIndex other than -1.");
|
||||
Debug.Assert(this.CurrentSlot != -1, "Expected CurrentSlot other than -1.");
|
||||
DiagnosticsDebug.Assert(this.CurrentColumnIndex != -1, "Expected CurrentColumnIndex other than -1.");
|
||||
DiagnosticsDebug.Assert(this.CurrentSlot != -1, "Expected CurrentSlot other than -1.");
|
||||
|
||||
int neighborVisibleWritableColumnIndex, neighborSlot;
|
||||
DataGridColumn dataGridColumn;
|
||||
|
@ -7732,12 +7734,12 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
targetSlot = neighborSlot;
|
||||
if (shift)
|
||||
{
|
||||
Debug.Assert(this.ColumnsInternal.LastVisibleWritableColumn != null, "Expected non-null ColumnsInternal.LastVisibleWritableColumn.");
|
||||
DiagnosticsDebug.Assert(this.ColumnsInternal.LastVisibleWritableColumn != null, "Expected non-null ColumnsInternal.LastVisibleWritableColumn.");
|
||||
targetColumnIndex = this.ColumnsInternal.LastVisibleWritableColumn.Index;
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Assert(this.ColumnsInternal.FirstVisibleWritableColumn != null, "Expected non-null ColumnsInternal.FirstVisibleWritableColumn.");
|
||||
DiagnosticsDebug.Assert(this.ColumnsInternal.FirstVisibleWritableColumn != null, "Expected non-null ColumnsInternal.FirstVisibleWritableColumn.");
|
||||
targetColumnIndex = this.ColumnsInternal.FirstVisibleWritableColumn.Index;
|
||||
}
|
||||
}
|
||||
|
@ -8020,17 +8022,17 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
// columnIndex = -1, rowIndex = 2 --> Unexpected
|
||||
private bool SetCurrentCellCore(int columnIndex, int slot, bool commitEdit, bool endRowEdit)
|
||||
{
|
||||
Debug.Assert(columnIndex < this.ColumnsItemsInternal.Count, "Expected columnIndex smaller than ColumnsItemsInternal.Count.");
|
||||
Debug.Assert(slot < this.SlotCount, "Expected slot smaller than this.SlotCount.");
|
||||
Debug.Assert(columnIndex == -1 || this.ColumnsItemsInternal[columnIndex].IsVisible, "Expected columnIndex equals -1 or ColumnsItemsInternal[columnIndex].IsVisible is true.");
|
||||
Debug.Assert(columnIndex <= -1 || slot != -1, "Expected columnIndex smaller than or equal to -1 or slot other than -1.");
|
||||
DiagnosticsDebug.Assert(columnIndex < this.ColumnsItemsInternal.Count, "Expected columnIndex smaller than ColumnsItemsInternal.Count.");
|
||||
DiagnosticsDebug.Assert(slot < this.SlotCount, "Expected slot smaller than this.SlotCount.");
|
||||
DiagnosticsDebug.Assert(columnIndex == -1 || this.ColumnsItemsInternal[columnIndex].IsVisible, "Expected columnIndex equals -1 or ColumnsItemsInternal[columnIndex].IsVisible is true.");
|
||||
DiagnosticsDebug.Assert(columnIndex <= -1 || slot != -1, "Expected columnIndex smaller than or equal to -1 or slot other than -1.");
|
||||
|
||||
if (columnIndex == this.CurrentColumnIndex &&
|
||||
slot == this.CurrentSlot)
|
||||
{
|
||||
Debug.Assert(this.DataConnection != null, "Expected non-null DataConnection.");
|
||||
Debug.Assert(_editingColumnIndex == -1 || _editingColumnIndex == this.CurrentColumnIndex, "Expected _editingColumnIndex equals -1 or _editingColumnIndex equals CurrentColumnIndex.");
|
||||
Debug.Assert(this.EditingRow == null || this.EditingRow.Slot == this.CurrentSlot || this.DataConnection.EndingEdit, "Expected EditingRow is null or EditingRow.Slot equals CurrentSlot or DataConnection.EndingEdit is true.");
|
||||
DiagnosticsDebug.Assert(this.DataConnection != null, "Expected non-null DataConnection.");
|
||||
DiagnosticsDebug.Assert(_editingColumnIndex == -1 || _editingColumnIndex == this.CurrentColumnIndex, "Expected _editingColumnIndex equals -1 or _editingColumnIndex equals CurrentColumnIndex.");
|
||||
DiagnosticsDebug.Assert(this.EditingRow == null || this.EditingRow.Slot == this.CurrentSlot || this.DataConnection.EndingEdit, "Expected EditingRow is null or EditingRow.Slot equals CurrentSlot or DataConnection.EndingEdit is true.");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -8049,8 +8051,8 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
|
||||
if (this.CurrentColumnIndex > -1)
|
||||
{
|
||||
Debug.Assert(this.CurrentColumnIndex < this.ColumnsItemsInternal.Count, "Expected CurrentColumnIndex smaller than ColumnsItemsInternal.Count.");
|
||||
Debug.Assert(this.CurrentSlot < this.SlotCount, "Expected CurrentSlot smaller than SlotCount.");
|
||||
DiagnosticsDebug.Assert(this.CurrentColumnIndex < this.ColumnsItemsInternal.Count, "Expected CurrentColumnIndex smaller than ColumnsItemsInternal.Count.");
|
||||
DiagnosticsDebug.Assert(this.CurrentSlot < this.SlotCount, "Expected CurrentSlot smaller than SlotCount.");
|
||||
|
||||
if (!IsInnerCellOutOfBounds(oldCurrentCell.ColumnIndex, oldCurrentCell.Slot) &&
|
||||
this.IsSlotVisible(oldCurrentCell.Slot))
|
||||
|
@ -8135,9 +8137,9 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
|
||||
if (this.CurrentColumnIndex > -1)
|
||||
{
|
||||
Debug.Assert(this.CurrentSlot > -1, "Expected CurrentSlot greater than -1.");
|
||||
Debug.Assert(this.CurrentColumnIndex < this.ColumnsItemsInternal.Count, "Expected CurrentColumnIndex smaller than ColumnsItemsInternal.Count.");
|
||||
Debug.Assert(this.CurrentSlot < this.SlotCount, "Expected CurrentSlot smaller than SlotCount.");
|
||||
DiagnosticsDebug.Assert(this.CurrentSlot > -1, "Expected CurrentSlot greater than -1.");
|
||||
DiagnosticsDebug.Assert(this.CurrentColumnIndex < this.ColumnsItemsInternal.Count, "Expected CurrentColumnIndex smaller than ColumnsItemsInternal.Count.");
|
||||
DiagnosticsDebug.Assert(this.CurrentSlot < this.SlotCount, "Expected CurrentSlot smaller than SlotCount.");
|
||||
if (this.IsSlotVisible(this.CurrentSlot))
|
||||
{
|
||||
UpdateCurrentState(this.DisplayData.GetDisplayedElement(this.CurrentSlot), this.CurrentColumnIndex, true /*applyCellState*/);
|
||||
|
@ -8418,13 +8420,13 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
{
|
||||
// maximum travel distance -- not the total width
|
||||
_hScrollBar.Maximum = totalVisibleWidth - cellsWidth;
|
||||
Debug.Assert(totalVisibleFrozenWidth >= 0, "Expected positive totalVisibleFrozenWidth.");
|
||||
DiagnosticsDebug.Assert(totalVisibleFrozenWidth >= 0, "Expected positive totalVisibleFrozenWidth.");
|
||||
if (_frozenColumnScrollBarSpacer != null)
|
||||
{
|
||||
_frozenColumnScrollBarSpacer.Width = totalVisibleFrozenWidth;
|
||||
}
|
||||
|
||||
Debug.Assert(_hScrollBar.Maximum >= 0, "Expected positive _hScrollBar.Maximum.");
|
||||
DiagnosticsDebug.Assert(_hScrollBar.Maximum >= 0, "Expected positive _hScrollBar.Maximum.");
|
||||
|
||||
// width of the scrollable viewing area
|
||||
double viewPortSize = Math.Max(0, cellsWidth - totalVisibleFrozenWidth);
|
||||
|
@ -8607,7 +8609,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
{
|
||||
bool beginEdit;
|
||||
|
||||
Debug.Assert(slot >= 0, "Expected positive slot.");
|
||||
DiagnosticsDebug.Assert(slot >= 0, "Expected positive slot.");
|
||||
|
||||
// Before changing selection, check if the current cell needs to be committed, and
|
||||
// check if the current row needs to be committed. If any of those two operations are required and fail,
|
||||
|
@ -8696,7 +8698,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
private void UpdateValidationResults(List<ValidationResult> newValidationResults, bool scrollIntoView)
|
||||
{
|
||||
bool validationResultsChanged = false;
|
||||
Debug.Assert(this.EditingRow != null, "Expected non-null EditingRow.");
|
||||
DiagnosticsDebug.Assert(this.EditingRow != null, "Expected non-null EditingRow.");
|
||||
|
||||
// Remove the validation results that have been fixed
|
||||
List<ValidationResult> removedValidationResults = new List<ValidationResult>();
|
||||
|
@ -8791,7 +8793,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
{
|
||||
bool isCellValid = true;
|
||||
|
||||
Debug.Assert(cell.OwningColumn != null, "Expected cell has owning column.");
|
||||
DiagnosticsDebug.Assert(cell.OwningColumn != null, "Expected cell has owning column.");
|
||||
if (!cell.OwningColumn.IsReadOnly)
|
||||
{
|
||||
foreach (ValidationResult validationResult in _validationResults)
|
||||
|
@ -8864,7 +8866,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
{
|
||||
// maximum travel distance -- not the total height
|
||||
_vScrollBar.Maximum = totalVisibleHeight - cellsHeight;
|
||||
Debug.Assert(_vScrollBar.Maximum >= 0, "Expected positive _vScrollBar.Maximum.");
|
||||
DiagnosticsDebug.Assert(_vScrollBar.Maximum >= 0, "Expected positive _vScrollBar.Maximum.");
|
||||
|
||||
// total height of the display area
|
||||
_vScrollBar.ViewportSize = cellsHeight;
|
||||
|
@ -8937,7 +8939,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
if (this.EditingRow != null)
|
||||
{
|
||||
object dataItem = this.EditingRow.DataContext;
|
||||
Debug.Assert(dataItem != null, "Expected non-null dataItem.");
|
||||
DiagnosticsDebug.Assert(dataItem != null, "Expected non-null dataItem.");
|
||||
|
||||
if (!_initializingNewItem)
|
||||
{
|
||||
|
@ -9047,7 +9049,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
string errorString = null;
|
||||
if (string.IsNullOrEmpty(bindingProperty))
|
||||
{
|
||||
Debug.Assert(string.IsNullOrEmpty(bindingPath));
|
||||
DiagnosticsDebug.Assert(string.IsNullOrEmpty(bindingPath));
|
||||
ValidationUtil.CatchNonCriticalExceptions(() => { errorString = idei.Error; });
|
||||
if (!string.IsNullOrEmpty(errorString))
|
||||
{
|
||||
|
@ -9104,7 +9106,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
}
|
||||
else
|
||||
{
|
||||
Debug.Assert(string.IsNullOrEmpty(bindingPath), "Expected bindingPath is null or empty.");
|
||||
DiagnosticsDebug.Assert(string.IsNullOrEmpty(bindingPath), "Expected bindingPath is null or empty.");
|
||||
validationResult = new ValidationResult(errorString);
|
||||
}
|
||||
|
||||
|
@ -9134,7 +9136,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
INotifyDataErrorInfo indei = sender as INotifyDataErrorInfo;
|
||||
if (_validationItems.ContainsKey(indei))
|
||||
{
|
||||
Debug.Assert(this.EditingRow != null, "Expected non-null EditingRow.");
|
||||
DiagnosticsDebug.Assert(this.EditingRow != null, "Expected non-null EditingRow.");
|
||||
|
||||
// Determine the binding path.
|
||||
string bindingPath = _validationItems[indei];
|
||||
|
|
|
@ -14,6 +14,8 @@ using Windows.UI.Xaml.Controls;
|
|||
using Windows.UI.Xaml.Input;
|
||||
using Windows.UI.Xaml.Shapes;
|
||||
|
||||
using DiagnosticsDebug = System.Diagnostics.Debug;
|
||||
|
||||
namespace Microsoft.Toolkit.Uwp.UI.Controls
|
||||
{
|
||||
/// <summary>
|
||||
|
@ -128,7 +130,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
{
|
||||
get
|
||||
{
|
||||
Debug.Assert(this.OwningGrid != null && this.OwningColumn != null && this.OwningRow != null, "Expected non-null owning DataGrid, DataGridColumn and DataGridRow.");
|
||||
DiagnosticsDebug.Assert(this.OwningGrid != null && this.OwningColumn != null && this.OwningRow != null, "Expected non-null owning DataGrid, DataGridColumn and DataGridRow.");
|
||||
|
||||
return this.OwningGrid.CurrentColumnIndex == this.OwningColumn.Index &&
|
||||
this.OwningGrid.CurrentSlot == this.OwningRow.Slot;
|
||||
|
@ -211,7 +213,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
{
|
||||
get
|
||||
{
|
||||
Debug.Assert(this.OwningGrid != null, "Expected non-null owning DataGrid.");
|
||||
DiagnosticsDebug.Assert(this.OwningGrid != null, "Expected non-null owning DataGrid.");
|
||||
|
||||
return this.OwningGrid.EditingRow == this.OwningRow &&
|
||||
this.OwningGrid.EditingColumnIndex == this.ColumnIndex;
|
||||
|
@ -444,13 +446,13 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
if (!e.Handled && this.OwningGrid.IsTabStop)
|
||||
{
|
||||
bool success = this.OwningGrid.Focus(FocusState.Programmatic);
|
||||
Debug.Assert(success, "Expected successful focus change.");
|
||||
DiagnosticsDebug.Assert(success, "Expected successful focus change.");
|
||||
}
|
||||
|
||||
if (this.OwningRow != null)
|
||||
{
|
||||
Debug.Assert(sender is DataGridCell, "Expected sender is DataGridCell.");
|
||||
Debug.Assert(sender == this, "Expected sender is this.");
|
||||
DiagnosticsDebug.Assert(sender is DataGridCell, "Expected sender is DataGridCell.");
|
||||
DiagnosticsDebug.Assert(sender == this, "Expected sender is this.");
|
||||
e.Handled = this.OwningGrid.UpdateStateOnTapped(e, this.ColumnIndex, this.OwningRow.Slot, !e.Handled /*allowEdit*/);
|
||||
this.OwningGrid.UpdatedStateOnTapped = true;
|
||||
}
|
||||
|
|
|
@ -10,6 +10,8 @@ using Windows.UI.Xaml;
|
|||
using Windows.UI.Xaml.Controls;
|
||||
using Windows.UI.Xaml.Media;
|
||||
|
||||
using DiagnosticsDebug = System.Diagnostics.Debug;
|
||||
|
||||
namespace Microsoft.Toolkit.Uwp.UI.Controls.Primitives
|
||||
{
|
||||
/// <summary>
|
||||
|
@ -79,8 +81,8 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls.Primitives
|
|||
foreach (DataGridColumn column in this.OwningGrid.ColumnsInternal.GetVisibleColumns())
|
||||
{
|
||||
DataGridCell cell = this.OwningRow.Cells[column.Index];
|
||||
Debug.Assert(cell.OwningColumn == column, "Expected column owner.");
|
||||
Debug.Assert(column.IsVisible, "Expected visible column.");
|
||||
DiagnosticsDebug.Assert(cell.OwningColumn == column, "Expected column owner.");
|
||||
DiagnosticsDebug.Assert(column.IsVisible, "Expected visible column.");
|
||||
|
||||
if (column.IsFrozen)
|
||||
{
|
||||
|
@ -318,9 +320,9 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls.Primitives
|
|||
|
||||
private bool ShouldDisplayCell(DataGridColumn column, double frozenLeftEdge, double scrollingLeftEdge)
|
||||
{
|
||||
Debug.Assert(this.OwningGrid != null, "Expected non-null owning DataGrid.");
|
||||
Debug.Assert(this.OwningGrid.HorizontalAdjustment >= 0, "Expected owning positive DataGrid.HorizontalAdjustment.");
|
||||
Debug.Assert(this.OwningGrid.HorizontalAdjustment <= this.OwningGrid.HorizontalOffset, "Expected owning DataGrid.HorizontalAdjustment smaller than or equal to DataGrid.HorizontalOffset.");
|
||||
DiagnosticsDebug.Assert(this.OwningGrid != null, "Expected non-null owning DataGrid.");
|
||||
DiagnosticsDebug.Assert(this.OwningGrid.HorizontalAdjustment >= 0, "Expected owning positive DataGrid.HorizontalAdjustment.");
|
||||
DiagnosticsDebug.Assert(this.OwningGrid.HorizontalAdjustment <= this.OwningGrid.HorizontalOffset, "Expected owning DataGrid.HorizontalAdjustment smaller than or equal to DataGrid.HorizontalOffset.");
|
||||
|
||||
if (column.Visibility != Visibility.Visible)
|
||||
{
|
||||
|
|
|
@ -14,6 +14,8 @@ using Windows.UI.Xaml.Controls;
|
|||
using Windows.UI.Xaml.Data;
|
||||
using Windows.UI.Xaml.Media;
|
||||
|
||||
using DiagnosticsDebug = System.Diagnostics.Debug;
|
||||
|
||||
namespace Microsoft.Toolkit.Uwp.UI.Controls
|
||||
{
|
||||
/// <summary>
|
||||
|
@ -730,8 +732,8 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
|
||||
set
|
||||
{
|
||||
Debug.Assert(value >= -1, "Expected value >= -1.");
|
||||
Debug.Assert(value < int.MaxValue, "Expected value < int.MaxValue.");
|
||||
DiagnosticsDebug.Assert(value >= -1, "Expected value >= -1.");
|
||||
DiagnosticsDebug.Assert(value < int.MaxValue, "Expected value < int.MaxValue.");
|
||||
|
||||
_displayIndexWithFiller = value;
|
||||
}
|
||||
|
@ -851,8 +853,8 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
|
||||
if (dataGridRow.OwningGrid == this.OwningGrid)
|
||||
{
|
||||
Debug.Assert(this.Index >= 0, "Expected positive Index.");
|
||||
Debug.Assert(this.Index < this.OwningGrid.ColumnsItemsInternal.Count, "Expected smaller Index.");
|
||||
DiagnosticsDebug.Assert(this.Index >= 0, "Expected positive Index.");
|
||||
DiagnosticsDebug.Assert(this.Index < this.OwningGrid.ColumnsItemsInternal.Count, "Expected smaller Index.");
|
||||
|
||||
DataGridCell dataGridCell = dataGridRow.Cells[this.Index];
|
||||
if (dataGridCell != null)
|
||||
|
@ -881,8 +883,8 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
throw DataGridError.DataGrid.NoOwningGrid(this.GetType());
|
||||
}
|
||||
|
||||
Debug.Assert(this.Index >= 0, "Expected positive Index.");
|
||||
Debug.Assert(this.Index < this.OwningGrid.ColumnsItemsInternal.Count, "Expected smaller Index.");
|
||||
DiagnosticsDebug.Assert(this.Index >= 0, "Expected positive Index.");
|
||||
DiagnosticsDebug.Assert(this.Index < this.OwningGrid.ColumnsItemsInternal.Count, "Expected smaller Index.");
|
||||
|
||||
DataGridRow dataGridRow = this.OwningGrid.GetRowFromItem(dataItem);
|
||||
if (dataGridRow == null)
|
||||
|
@ -1096,7 +1098,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
|
||||
if (_inputBindings != null)
|
||||
{
|
||||
Debug.Assert(this.OwningGrid != null, "Expected non-null owning DataGrid.");
|
||||
DiagnosticsDebug.Assert(this.OwningGrid != null, "Expected non-null owning DataGrid.");
|
||||
|
||||
// Use the editing bindings if they've already been created
|
||||
bindings = _inputBindings;
|
||||
|
@ -1195,7 +1197,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
/// <returns>The resultant cell value.</returns>
|
||||
internal object GetCellValue(object item, Binding binding)
|
||||
{
|
||||
Debug.Assert(this.OwningGrid != null, "Expected non-null owning DataGrid.");
|
||||
DiagnosticsDebug.Assert(this.OwningGrid != null, "Expected non-null owning DataGrid.");
|
||||
|
||||
object content = null;
|
||||
if (binding != null)
|
||||
|
@ -1281,7 +1283,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
/// <param name="userInitiated">Whether or not this resize was initiated by a user action.</param>
|
||||
internal void Resize(double value, DataGridLengthUnitType unitType, double desiredValue, double displayValue, bool userInitiated)
|
||||
{
|
||||
Debug.Assert(this.OwningGrid != null, "Expected non-null owning DataGrid.");
|
||||
DiagnosticsDebug.Assert(this.OwningGrid != null, "Expected non-null owning DataGrid.");
|
||||
|
||||
double newValue = value;
|
||||
double newDesiredValue = desiredValue;
|
||||
|
@ -1408,7 +1410,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
/// <param name="value">The new star value.</param>
|
||||
internal void SetWidthStarValue(double value)
|
||||
{
|
||||
Debug.Assert(this.Width.IsStar, "Expected Width.IsStar.");
|
||||
DiagnosticsDebug.Assert(this.Width.IsStar, "Expected Width.IsStar.");
|
||||
|
||||
this.InheritsWidth = false;
|
||||
SetWidthInternalNoCallback(new DataGridLength(value, this.Width.UnitType, this.Width.DesiredValue, this.Width.DisplayValue));
|
||||
|
|
|
@ -20,6 +20,8 @@ using Windows.UI.Xaml.Controls.Primitives;
|
|||
using Windows.UI.Xaml.Input;
|
||||
using Windows.UI.Xaml.Media;
|
||||
|
||||
using DiagnosticsDebug = System.Diagnostics.Debug;
|
||||
|
||||
namespace Microsoft.Toolkit.Uwp.UI.Controls.Primitives
|
||||
{
|
||||
/// <summary>
|
||||
|
@ -304,7 +306,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls.Primitives
|
|||
|
||||
internal void InvokeProcessSort()
|
||||
{
|
||||
Debug.Assert(this.OwningGrid != null, "Expected non-null owning DataGrid.");
|
||||
DiagnosticsDebug.Assert(this.OwningGrid != null, "Expected non-null owning DataGrid.");
|
||||
|
||||
if (this.OwningGrid.WaitForLostFocus(() => { this.InvokeProcessSort(); }))
|
||||
{
|
||||
|
@ -346,7 +348,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls.Primitives
|
|||
|
||||
SortDescription? sort = this.OwningColumn.GetSortDescription();
|
||||
ICollectionView collectionView = owningGrid.DataConnection.CollectionView;
|
||||
Debug.Assert(collectionView != null);
|
||||
DiagnosticsDebug.Assert(collectionView != null);
|
||||
try
|
||||
{
|
||||
owningGrid.OnUserSorting();
|
||||
|
@ -485,7 +487,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls.Primitives
|
|||
{
|
||||
DataGridColumnHeaderInteractionInfo interactionInfo = this.OwningGrid.ColumnHeaderInteractionInfo;
|
||||
|
||||
Debug.Assert(interactionInfo.DragMode != DragMode.None, "Expected _dragMode other than None.");
|
||||
DiagnosticsDebug.Assert(interactionInfo.DragMode != DragMode.None, "Expected _dragMode other than None.");
|
||||
|
||||
interactionInfo.DragColumn = column;
|
||||
interactionInfo.DragMode = DragMode.Resize;
|
||||
|
@ -616,7 +618,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls.Primitives
|
|||
return;
|
||||
}
|
||||
|
||||
Debug.Assert(interactionInfo.DragPointerId == 0, "Expected _dragPointerId is 0.");
|
||||
DiagnosticsDebug.Assert(interactionInfo.DragPointerId == 0, "Expected _dragPointerId is 0.");
|
||||
|
||||
bool handled = e.Handled;
|
||||
|
||||
|
@ -635,8 +637,8 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls.Primitives
|
|||
interactionInfo.CapturedPointer = null;
|
||||
}
|
||||
|
||||
Debug.Assert(interactionInfo.DragMode == DragMode.None, "Expected _dragMode equals None.");
|
||||
Debug.Assert(interactionInfo.DragColumn == null, "Expected _dragColumn is null.");
|
||||
DiagnosticsDebug.Assert(interactionInfo.DragMode == DragMode.None, "Expected _dragMode equals None.");
|
||||
DiagnosticsDebug.Assert(interactionInfo.DragColumn == null, "Expected _dragColumn is null.");
|
||||
interactionInfo.DragMode = DragMode.PointerPressed;
|
||||
interactionInfo.DragPointerId = e.Pointer.PointerId;
|
||||
interactionInfo.FrozenColumnsWidth = this.OwningGrid.ColumnsInternal.GetVisibleFrozenEdgedColumnsWidth();
|
||||
|
@ -775,7 +777,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls.Primitives
|
|||
Point pointerPositionHeaders = e.GetCurrentPoint(this.OwningGrid.ColumnHeaders).Position;
|
||||
bool handled = false;
|
||||
|
||||
Debug.Assert(this.OwningGrid.Parent is UIElement, "Expected owning DataGrid's parent to be a UIElement.");
|
||||
DiagnosticsDebug.Assert(this.OwningGrid.Parent is UIElement, "Expected owning DataGrid's parent to be a UIElement.");
|
||||
|
||||
double distanceFromLeft = pointerPosition.X;
|
||||
double distanceFromRight = this.ActualWidth - distanceFromLeft;
|
||||
|
@ -820,7 +822,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls.Primitives
|
|||
/// <returns>The column against whose top-left the reordering caret should be positioned.</returns>
|
||||
private DataGridColumn GetReorderingTargetColumn(Point pointerPositionHeaders, bool scroll, out double scrollAmount)
|
||||
{
|
||||
Debug.Assert(this.OwningGrid != null, "Expected non-null OwningGrid.");
|
||||
DiagnosticsDebug.Assert(this.OwningGrid != null, "Expected non-null OwningGrid.");
|
||||
|
||||
scrollAmount = 0;
|
||||
double leftEdge = 0;
|
||||
|
@ -894,7 +896,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls.Primitives
|
|||
/// <returns>The display index to set the column to.</returns>
|
||||
private int GetReorderingTargetDisplayIndex(Point pointerPositionHeaders)
|
||||
{
|
||||
Debug.Assert(this.OwningGrid != null, "Expected non-null OwningGrid.");
|
||||
DiagnosticsDebug.Assert(this.OwningGrid != null, "Expected non-null OwningGrid.");
|
||||
|
||||
DataGridColumn targetColumn = GetReorderingTargetColumn(pointerPositionHeaders, false /*scroll*/, out _);
|
||||
if (targetColumn != null)
|
||||
|
@ -909,7 +911,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls.Primitives
|
|||
|
||||
private void OnPointerMove_BeginReorder(uint pointerId, Point pointerPosition)
|
||||
{
|
||||
Debug.Assert(this.OwningGrid != null, "Expected non-null OwningGrid.");
|
||||
DiagnosticsDebug.Assert(this.OwningGrid != null, "Expected non-null OwningGrid.");
|
||||
|
||||
DataGridColumnHeader dragIndicator = new DataGridColumnHeader();
|
||||
dragIndicator.OwningColumn = this.OwningColumn;
|
||||
|
@ -957,7 +959,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls.Primitives
|
|||
|
||||
// The app didn't cancel, so prepare for the reorder.
|
||||
interactionInfo.DragColumn = this.OwningColumn;
|
||||
Debug.Assert(interactionInfo.DragMode != DragMode.None, "Expected _dragMode other than None.");
|
||||
DiagnosticsDebug.Assert(interactionInfo.DragMode != DragMode.None, "Expected _dragMode other than None.");
|
||||
interactionInfo.DragMode = DragMode.Reorder;
|
||||
interactionInfo.DragPointerId = pointerId;
|
||||
interactionInfo.DragStart = pointerPosition;
|
||||
|
@ -970,7 +972,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls.Primitives
|
|||
|
||||
private void OnPointerMove_Reorder(ref bool handled, Pointer pointer, Point pointerPosition, Point pointerPositionHeaders, double distanceFromLeft, double distanceFromRight)
|
||||
{
|
||||
Debug.Assert(this.OwningGrid != null, "Expected non-null OwningGrid.");
|
||||
DiagnosticsDebug.Assert(this.OwningGrid != null, "Expected non-null OwningGrid.");
|
||||
|
||||
if (handled)
|
||||
{
|
||||
|
@ -1035,13 +1037,13 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls.Primitives
|
|||
|
||||
private void OnPointerMove_Resize(ref bool handled, Point pointerPositionHeaders)
|
||||
{
|
||||
Debug.Assert(this.OwningGrid != null, "Expected non-null OwningGrid.");
|
||||
DiagnosticsDebug.Assert(this.OwningGrid != null, "Expected non-null OwningGrid.");
|
||||
|
||||
DataGridColumnHeaderInteractionInfo interactionInfo = this.OwningGrid.ColumnHeaderInteractionInfo;
|
||||
|
||||
if (!handled && interactionInfo.DragMode == DragMode.Resize && interactionInfo.DragColumn != null && interactionInfo.DragStart.HasValue)
|
||||
{
|
||||
Debug.Assert(interactionInfo.ResizePointerId != 0, "Expected interactionInfo.ResizePointerId other than 0.");
|
||||
DiagnosticsDebug.Assert(interactionInfo.ResizePointerId != 0, "Expected interactionInfo.ResizePointerId other than 0.");
|
||||
|
||||
// Resize column
|
||||
double pointerDelta = pointerPositionHeaders.X - interactionInfo.DragStart.Value.X;
|
||||
|
@ -1058,13 +1060,13 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls.Primitives
|
|||
|
||||
private void SetOriginalCursor()
|
||||
{
|
||||
Debug.Assert(this.OwningGrid != null, "Expected non-null OwningGrid.");
|
||||
DiagnosticsDebug.Assert(this.OwningGrid != null, "Expected non-null OwningGrid.");
|
||||
|
||||
DataGridColumnHeaderInteractionInfo interactionInfo = this.OwningGrid.ColumnHeaderInteractionInfo;
|
||||
|
||||
if (interactionInfo.ResizePointerId != 0)
|
||||
{
|
||||
Debug.Assert(interactionInfo.OriginalCursor != null, "Expected non-null interactionInfo.OriginalCursor.");
|
||||
DiagnosticsDebug.Assert(interactionInfo.OriginalCursor != null, "Expected non-null interactionInfo.OriginalCursor.");
|
||||
|
||||
Window.Current.CoreWindow.PointerCursor = interactionInfo.OriginalCursor;
|
||||
interactionInfo.ResizePointerId = 0;
|
||||
|
@ -1073,7 +1075,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls.Primitives
|
|||
|
||||
private void SetResizeCursor(Pointer pointer, Point pointerPosition)
|
||||
{
|
||||
Debug.Assert(this.OwningGrid != null, "Expected non-null OwningGrid.");
|
||||
DiagnosticsDebug.Assert(this.OwningGrid != null, "Expected non-null OwningGrid.");
|
||||
|
||||
DataGridColumnHeaderInteractionInfo interactionInfo = this.OwningGrid.ColumnHeaderInteractionInfo;
|
||||
|
||||
|
|
|
@ -11,6 +11,8 @@ using Windows.UI.Xaml.Automation.Peers;
|
|||
using Windows.UI.Xaml.Controls;
|
||||
using Windows.UI.Xaml.Media;
|
||||
|
||||
using DiagnosticsDebug = System.Diagnostics.Debug;
|
||||
|
||||
namespace Microsoft.Toolkit.Uwp.UI.Controls.Primitives
|
||||
{
|
||||
/// <summary>
|
||||
|
@ -143,7 +145,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls.Primitives
|
|||
foreach (DataGridColumn dataGridColumn in this.OwningGrid.ColumnsInternal.GetVisibleColumns())
|
||||
{
|
||||
DataGridColumnHeader columnHeader = dataGridColumn.HeaderCell;
|
||||
Debug.Assert(columnHeader.OwningColumn == dataGridColumn, "Expected columnHeader owned by dataGridColumn.");
|
||||
DiagnosticsDebug.Assert(columnHeader.OwningColumn == dataGridColumn, "Expected columnHeader owned by dataGridColumn.");
|
||||
|
||||
if (dataGridColumn.IsFrozen)
|
||||
{
|
||||
|
@ -382,7 +384,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls.Primitives
|
|||
DataGridFillerColumn fillerColumn = this.OwningGrid.ColumnsInternal.FillerColumn;
|
||||
if (!fillerColumn.IsRepresented)
|
||||
{
|
||||
Debug.Assert(!this.Children.Contains(fillerColumn.HeaderCell), "Unexpected parent for filler column header cell.");
|
||||
DiagnosticsDebug.Assert(!this.Children.Contains(fillerColumn.HeaderCell), "Unexpected parent for filler column header cell.");
|
||||
fillerColumn.HeaderCell.SeparatorVisibility = Visibility.Collapsed;
|
||||
this.Children.Insert(this.OwningGrid.ColumnsInternal.Count, fillerColumn.HeaderCell);
|
||||
fillerColumn.IsRepresented = true;
|
||||
|
|
|
@ -15,6 +15,8 @@ using Windows.UI.Xaml;
|
|||
using Windows.UI.Xaml.Controls.Primitives;
|
||||
using Windows.UI.Xaml.Data;
|
||||
|
||||
using DiagnosticsDebug = System.Diagnostics.Debug;
|
||||
|
||||
namespace Microsoft.Toolkit.Uwp.UI.Controls
|
||||
{
|
||||
/// <summary>
|
||||
|
@ -63,7 +65,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
// Returns the column's width
|
||||
internal static double GetEdgedColumnWidth(DataGridColumn dataGridColumn)
|
||||
{
|
||||
Debug.Assert(dataGridColumn != null, "Expected non-null dataGridColumn.");
|
||||
DiagnosticsDebug.Assert(dataGridColumn != null, "Expected non-null dataGridColumn.");
|
||||
return dataGridColumn.ActualWidth;
|
||||
}
|
||||
|
||||
|
@ -100,7 +102,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
/// <param name="desiredWidth">The new desired width of the column.</param>
|
||||
internal void AutoSizeColumn(DataGridColumn column, double desiredWidth)
|
||||
{
|
||||
Debug.Assert(
|
||||
DiagnosticsDebug.Assert(
|
||||
column.Width.IsAuto || column.Width.IsSizeToCells || column.Width.IsSizeToHeader || (!this.UsesStarSizing && column.Width.IsStar),
|
||||
"Expected column.Width.IsAuto or column.Width.IsSizeToCells or column.Width.IsSizeToHeader or (!UsesStarSizing && column.Width.IsStar).");
|
||||
|
||||
|
@ -170,7 +172,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
|
||||
internal bool GetColumnReadOnlyState(DataGridColumn dataGridColumn, bool isReadOnly)
|
||||
{
|
||||
Debug.Assert(dataGridColumn != null, "Expected non-null dataGridColumn.");
|
||||
DiagnosticsDebug.Assert(dataGridColumn != null, "Expected non-null dataGridColumn.");
|
||||
|
||||
DataGridBoundColumn dataGridBoundColumn = dataGridColumn as DataGridBoundColumn;
|
||||
if (dataGridBoundColumn != null && dataGridBoundColumn.Binding != null)
|
||||
|
@ -285,7 +287,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
|
||||
internal void OnColumnDisplayIndexChanged(DataGridColumn dataGridColumn)
|
||||
{
|
||||
Debug.Assert(dataGridColumn != null, "Expected non-null dataGridColumn.");
|
||||
DiagnosticsDebug.Assert(dataGridColumn != null, "Expected non-null dataGridColumn.");
|
||||
DataGridColumnEventArgs e = new DataGridColumnEventArgs(dataGridColumn);
|
||||
|
||||
// Call protected method to raise event
|
||||
|
@ -310,8 +312,8 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
|
||||
internal void OnColumnDisplayIndexChanging(DataGridColumn targetColumn, int newDisplayIndex)
|
||||
{
|
||||
Debug.Assert(targetColumn != null, "Expected non-null targetColumn.");
|
||||
Debug.Assert(newDisplayIndex != targetColumn.DisplayIndexWithFiller, "Expected newDisplayIndex other than targetColumn.DisplayIndexWithFiller.");
|
||||
DiagnosticsDebug.Assert(targetColumn != null, "Expected non-null targetColumn.");
|
||||
DiagnosticsDebug.Assert(newDisplayIndex != targetColumn.DisplayIndexWithFiller, "Expected newDisplayIndex other than targetColumn.DisplayIndexWithFiller.");
|
||||
|
||||
if (InDisplayIndexAdjustments)
|
||||
{
|
||||
|
@ -430,7 +432,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
/// <param name="oldValue">The old ActualMaxWidth of the column.</param>
|
||||
internal void OnColumnMaxWidthChanged(DataGridColumn column, double oldValue)
|
||||
{
|
||||
Debug.Assert(column != null, "Expected non-null column.");
|
||||
DiagnosticsDebug.Assert(column != null, "Expected non-null column.");
|
||||
|
||||
if (column.Visibility == Visibility.Visible && oldValue != column.ActualMaxWidth)
|
||||
{
|
||||
|
@ -460,7 +462,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
/// <param name="oldValue">The old ActualMinWidth of the column.</param>
|
||||
internal void OnColumnMinWidthChanged(DataGridColumn column, double oldValue)
|
||||
{
|
||||
Debug.Assert(column != null, "Expected non-null column.");
|
||||
DiagnosticsDebug.Assert(column != null, "Expected non-null column.");
|
||||
|
||||
if (column.Visibility == Visibility.Visible && oldValue != column.ActualMinWidth)
|
||||
{
|
||||
|
@ -485,7 +487,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
|
||||
internal void OnColumnReadOnlyStateChanging(DataGridColumn dataGridColumn, bool isReadOnly)
|
||||
{
|
||||
Debug.Assert(dataGridColumn != null, "Expected non-null dataGridColumn.");
|
||||
DiagnosticsDebug.Assert(dataGridColumn != null, "Expected non-null dataGridColumn.");
|
||||
if (isReadOnly && this.CurrentColumnIndex == dataGridColumn.Index)
|
||||
{
|
||||
// Edited column becomes read-only. Exit editing mode.
|
||||
|
@ -498,7 +500,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
|
||||
internal void OnColumnVisibleStateChanged(DataGridColumn updatedColumn)
|
||||
{
|
||||
Debug.Assert(updatedColumn != null, "Expected non-null updatedColumn.");
|
||||
DiagnosticsDebug.Assert(updatedColumn != null, "Expected non-null updatedColumn.");
|
||||
|
||||
CorrectColumnFrozenStates();
|
||||
UpdateDisplayedColumns();
|
||||
|
@ -509,7 +511,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
if (updatedColumn.IsVisible &&
|
||||
this.ColumnsInternal.VisibleColumnCount == 1 && this.CurrentColumnIndex == -1)
|
||||
{
|
||||
Debug.Assert(this.SelectedIndex == this.DataConnection.IndexOf(this.SelectedItem), "Expected SelectedIndex equals DataConnection.IndexOf(this.SelectedItem).");
|
||||
DiagnosticsDebug.Assert(this.SelectedIndex == this.DataConnection.IndexOf(this.SelectedItem), "Expected SelectedIndex equals DataConnection.IndexOf(this.SelectedItem).");
|
||||
if (this.SelectedIndex != -1)
|
||||
{
|
||||
SetAndSelectCurrentCell(updatedColumn.Index, this.SelectedIndex, true /*forceCurrentCellSelection*/);
|
||||
|
@ -533,7 +535,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
|
||||
internal void OnColumnVisibleStateChanging(DataGridColumn targetColumn)
|
||||
{
|
||||
Debug.Assert(targetColumn != null, "Expected non-null targetColumn.");
|
||||
DiagnosticsDebug.Assert(targetColumn != null, "Expected non-null targetColumn.");
|
||||
|
||||
if (targetColumn.IsVisible && this.CurrentColumn == targetColumn)
|
||||
{
|
||||
|
@ -557,7 +559,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
|
||||
internal void OnColumnWidthChanged(DataGridColumn updatedColumn)
|
||||
{
|
||||
Debug.Assert(updatedColumn != null, "Expected non-null updatedColumn.");
|
||||
DiagnosticsDebug.Assert(updatedColumn != null, "Expected non-null updatedColumn.");
|
||||
if (updatedColumn.IsVisible)
|
||||
{
|
||||
EnsureHorizontalLayout();
|
||||
|
@ -583,7 +585,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
// Update current cell if needed
|
||||
if (newCurrentCellCoordinates.ColumnIndex != -1)
|
||||
{
|
||||
Debug.Assert(this.CurrentColumnIndex == -1, "Expected CurrentColumnIndex equals -1.");
|
||||
DiagnosticsDebug.Assert(this.CurrentColumnIndex == -1, "Expected CurrentColumnIndex equals -1.");
|
||||
SetAndSelectCurrentCell(
|
||||
newCurrentCellCoordinates.ColumnIndex,
|
||||
newCurrentCellCoordinates.Slot,
|
||||
|
@ -601,9 +603,9 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
// Fix the Index of all following columns
|
||||
CorrectColumnIndexesAfterInsertion(insertedColumn, 1);
|
||||
|
||||
Debug.Assert(insertedColumn.Index >= 0, "Expected positive insertedColumn.Index.");
|
||||
Debug.Assert(insertedColumn.Index < this.ColumnsItemsInternal.Count, "insertedColumn.Index smaller than ColumnsItemsInternal.Count.");
|
||||
Debug.Assert(insertedColumn.OwningGrid == this, "Expected insertedColumn.OwningGrid equals this DataGrid.");
|
||||
DiagnosticsDebug.Assert(insertedColumn.Index >= 0, "Expected positive insertedColumn.Index.");
|
||||
DiagnosticsDebug.Assert(insertedColumn.Index < this.ColumnsItemsInternal.Count, "insertedColumn.Index smaller than ColumnsItemsInternal.Count.");
|
||||
DiagnosticsDebug.Assert(insertedColumn.OwningGrid == this, "Expected insertedColumn.OwningGrid equals this DataGrid.");
|
||||
|
||||
CorrectColumnDisplayIndexesAfterInsertion(insertedColumn);
|
||||
|
||||
|
@ -638,7 +640,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
internal DataGridCellCoordinates OnInsertingColumn(int columnIndexInserted, DataGridColumn insertColumn)
|
||||
{
|
||||
DataGridCellCoordinates newCurrentCellCoordinates;
|
||||
Debug.Assert(insertColumn != null, "Expected non-null insertColumn.");
|
||||
DiagnosticsDebug.Assert(insertColumn != null, "Expected non-null insertColumn.");
|
||||
|
||||
if (insertColumn.OwningGrid != null && insertColumn != this.ColumnsInternal.RowGroupSpacerColumn)
|
||||
{
|
||||
|
@ -667,15 +669,15 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
// Update current cell if needed
|
||||
if (newCurrentCellCoordinates.ColumnIndex != -1)
|
||||
{
|
||||
Debug.Assert(this.CurrentColumnIndex == -1, "Expected CurrentColumnIndex equals -1.");
|
||||
DiagnosticsDebug.Assert(this.CurrentColumnIndex == -1, "Expected CurrentColumnIndex equals -1.");
|
||||
SetAndSelectCurrentCell(newCurrentCellCoordinates.ColumnIndex, newCurrentCellCoordinates.Slot, false /*forceCurrentCellSelection*/);
|
||||
}
|
||||
}
|
||||
|
||||
internal void OnRemovedColumn_PreNotification(DataGridColumn removedColumn)
|
||||
{
|
||||
Debug.Assert(removedColumn.Index >= 0, "Expected positive removedColumn.Index.");
|
||||
Debug.Assert(removedColumn.OwningGrid == null, "Expected null removedColumn.OwningGrid.");
|
||||
DiagnosticsDebug.Assert(removedColumn.Index >= 0, "Expected positive removedColumn.Index.");
|
||||
DiagnosticsDebug.Assert(removedColumn.OwningGrid == null, "Expected null removedColumn.OwningGrid.");
|
||||
|
||||
// Intentionally keep the DisplayIndex intact after detaching the column.
|
||||
CorrectColumnIndexesAfterDeletion(removedColumn);
|
||||
|
@ -712,9 +714,9 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
|
||||
internal DataGridCellCoordinates OnRemovingColumn(DataGridColumn dataGridColumn)
|
||||
{
|
||||
Debug.Assert(dataGridColumn != null, "Expected non-null dataGridColumn.");
|
||||
Debug.Assert(dataGridColumn.Index >= 0, "Expected positive dataGridColumn.Index.");
|
||||
Debug.Assert(dataGridColumn.Index < this.ColumnsItemsInternal.Count, "Expected dataGridColumn.Index smaller than ColumnsItemsInternal.Count.");
|
||||
DiagnosticsDebug.Assert(dataGridColumn != null, "Expected non-null dataGridColumn.");
|
||||
DiagnosticsDebug.Assert(dataGridColumn.Index >= 0, "Expected positive dataGridColumn.Index.");
|
||||
DiagnosticsDebug.Assert(dataGridColumn.Index < this.ColumnsItemsInternal.Count, "Expected dataGridColumn.Index smaller than ColumnsItemsInternal.Count.");
|
||||
|
||||
DataGridCellCoordinates newCurrentCellCoordinates;
|
||||
|
||||
|
@ -781,7 +783,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
}
|
||||
|
||||
bool success = this.SetCurrentCellCore(-1, -1);
|
||||
Debug.Assert(success, "Expected successful call to SetCurrentCellCore.");
|
||||
DiagnosticsDebug.Assert(success, "Expected successful call to SetCurrentCellCore.");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -809,7 +811,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
else if (!this.ColumnsInternal.DisplayInOrder(this.DisplayData.FirstDisplayedScrollingCol, dataGridColumn.Index))
|
||||
{
|
||||
// Deleted column is displayed before first scrolling column
|
||||
Debug.Assert(_horizontalOffset >= GetEdgedColumnWidth(dataGridColumn), "Expected _horizontalOffset greater than or equal to GetEdgedColumnWidth(dataGridColumn).");
|
||||
DiagnosticsDebug.Assert(_horizontalOffset >= GetEdgedColumnWidth(dataGridColumn), "Expected _horizontalOffset greater than or equal to GetEdgedColumnWidth(dataGridColumn).");
|
||||
_horizontalOffset -= GetEdgedColumnWidth(dataGridColumn);
|
||||
}
|
||||
|
||||
|
@ -827,13 +829,13 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
/// </summary>
|
||||
internal void RefreshColumnElements(DataGridColumn dataGridColumn, string propertyName)
|
||||
{
|
||||
Debug.Assert(dataGridColumn != null, "Expected non-null dataGridColumn.");
|
||||
DiagnosticsDebug.Assert(dataGridColumn != null, "Expected non-null dataGridColumn.");
|
||||
|
||||
// Take care of the non-displayed loaded rows
|
||||
for (int index = 0; index < _loadedRows.Count;)
|
||||
{
|
||||
DataGridRow dataGridRow = _loadedRows[index];
|
||||
Debug.Assert(dataGridRow != null, "Expected non-null dataGridRow.");
|
||||
DiagnosticsDebug.Assert(dataGridRow != null, "Expected non-null dataGridRow.");
|
||||
if (!this.IsSlotVisible(dataGridRow.Slot))
|
||||
{
|
||||
RefreshCellElement(dataGridColumn, dataGridRow, propertyName);
|
||||
|
@ -867,8 +869,8 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
/// <returns>The remaining amount of adjustment.</returns>
|
||||
private static double DecreaseNonStarColumnWidth(DataGridColumn column, double targetWidth, double amount)
|
||||
{
|
||||
Debug.Assert(amount < 0, "Expected negative amount.");
|
||||
Debug.Assert(column.Width.UnitType != DataGridLengthUnitType.Star, "column.Width.UnitType other than DataGridLengthUnitType.Star.");
|
||||
DiagnosticsDebug.Assert(amount < 0, "Expected negative amount.");
|
||||
DiagnosticsDebug.Assert(column.Width.UnitType != DataGridLengthUnitType.Star, "column.Width.UnitType other than DataGridLengthUnitType.Star.");
|
||||
|
||||
if (DoubleUtil.GreaterThanOrClose(targetWidth, column.Width.DisplayValue))
|
||||
{
|
||||
|
@ -897,7 +899,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
|
||||
private static DataGridBoundColumn GetDataGridColumnFromType(Type type)
|
||||
{
|
||||
Debug.Assert(type != null, "Expected non-null type.");
|
||||
DiagnosticsDebug.Assert(type != null, "Expected non-null type.");
|
||||
if (type == typeof(bool))
|
||||
{
|
||||
return new DataGridCheckBoxColumn();
|
||||
|
@ -923,8 +925,8 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
/// <returns>The remaining amount of adjustment.</returns>
|
||||
private static double IncreaseNonStarColumnWidth(DataGridColumn column, double targetWidth, double amount)
|
||||
{
|
||||
Debug.Assert(amount > 0, "Expected strictly positive amount.");
|
||||
Debug.Assert(column.Width.UnitType != DataGridLengthUnitType.Star, "Expected column.Width.UnitType other than DataGridLengthUnitType.Star.");
|
||||
DiagnosticsDebug.Assert(amount > 0, "Expected strictly positive amount.");
|
||||
DiagnosticsDebug.Assert(column.Width.UnitType != DataGridLengthUnitType.Star, "Expected column.Width.UnitType other than DataGridLengthUnitType.Star.");
|
||||
|
||||
if (targetWidth <= column.Width.DisplayValue)
|
||||
{
|
||||
|
@ -941,11 +943,11 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
|
||||
private static void RefreshCellElement(DataGridColumn dataGridColumn, DataGridRow dataGridRow, string propertyName)
|
||||
{
|
||||
Debug.Assert(dataGridColumn != null, "Expected non-null dataGridColumn.");
|
||||
Debug.Assert(dataGridRow != null, "Expected non-null dataGridRow.");
|
||||
DiagnosticsDebug.Assert(dataGridColumn != null, "Expected non-null dataGridColumn.");
|
||||
DiagnosticsDebug.Assert(dataGridRow != null, "Expected non-null dataGridRow.");
|
||||
|
||||
DataGridCell dataGridCell = dataGridRow.Cells[dataGridColumn.Index];
|
||||
Debug.Assert(dataGridCell != null, "Expected non-null dataGridCell.");
|
||||
DiagnosticsDebug.Assert(dataGridCell != null, "Expected non-null dataGridCell.");
|
||||
FrameworkElement element = dataGridCell.Content as FrameworkElement;
|
||||
if (element != null)
|
||||
{
|
||||
|
@ -1165,7 +1167,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
}
|
||||
}
|
||||
|
||||
Debug.Assert(cx <= this.ColumnsInternal.GetVisibleFrozenEdgedColumnsWidth(), "cx smaller than or equal to ColumnsInternal.GetVisibleFrozenEdgedColumnsWidth().");
|
||||
DiagnosticsDebug.Assert(cx <= this.ColumnsInternal.GetVisibleFrozenEdgedColumnsWidth(), "cx smaller than or equal to ColumnsInternal.GetVisibleFrozenEdgedColumnsWidth().");
|
||||
|
||||
if (cx < displayWidth && firstDisplayedScrollingCol >= 0)
|
||||
{
|
||||
|
@ -1198,7 +1200,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
// if we inflate the data area then we paint columns to the left of firstDisplayedScrollingCol
|
||||
if (cx < displayWidth)
|
||||
{
|
||||
Debug.Assert(firstDisplayedScrollingCol >= 0, "Expected positive firstDisplayedScrollingCol.");
|
||||
DiagnosticsDebug.Assert(firstDisplayedScrollingCol >= 0, "Expected positive firstDisplayedScrollingCol.");
|
||||
|
||||
// first minimize value of _negHorizontalOffset
|
||||
if (_negHorizontalOffset > 0)
|
||||
|
@ -1232,7 +1234,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
// second try to scroll entire columns
|
||||
if (cx < displayWidth && _horizontalOffset > 0)
|
||||
{
|
||||
Debug.Assert(_negHorizontalOffset == 0, "Expected _negHorizontalOffset equals 0.");
|
||||
DiagnosticsDebug.Assert(_negHorizontalOffset == 0, "Expected _negHorizontalOffset equals 0.");
|
||||
dataGridColumn = this.ColumnsInternal.GetPreviousVisibleScrollingColumn(this.ColumnsItemsInternal[firstDisplayedScrollingCol]);
|
||||
while (dataGridColumn != null && cx + GetEdgedColumnWidth(dataGridColumn) <= displayWidth)
|
||||
{
|
||||
|
@ -1248,21 +1250,21 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
// third try to partially scroll in first scrolled off column
|
||||
if (cx < displayWidth && _horizontalOffset > 0)
|
||||
{
|
||||
Debug.Assert(_negHorizontalOffset == 0, "Expected _negHorizontalOffset equals 0.");
|
||||
DiagnosticsDebug.Assert(_negHorizontalOffset == 0, "Expected _negHorizontalOffset equals 0.");
|
||||
dataGridColumn = this.ColumnsInternal.GetPreviousVisibleScrollingColumn(this.ColumnsItemsInternal[firstDisplayedScrollingCol]);
|
||||
Debug.Assert(dataGridColumn != null, "Expected non-null dataGridColumn.");
|
||||
Debug.Assert(GetEdgedColumnWidth(dataGridColumn) > displayWidth - cx, "Expected GetEdgedColumnWidth(dataGridColumn) greater than displayWidth - cx.");
|
||||
DiagnosticsDebug.Assert(dataGridColumn != null, "Expected non-null dataGridColumn.");
|
||||
DiagnosticsDebug.Assert(GetEdgedColumnWidth(dataGridColumn) > displayWidth - cx, "Expected GetEdgedColumnWidth(dataGridColumn) greater than displayWidth - cx.");
|
||||
firstDisplayedScrollingCol = dataGridColumn.Index;
|
||||
_negHorizontalOffset = GetEdgedColumnWidth(dataGridColumn) - displayWidth + cx;
|
||||
_horizontalOffset -= displayWidth - cx;
|
||||
visibleScrollingColumnsTmp++;
|
||||
invalidate = true;
|
||||
cx = displayWidth;
|
||||
Debug.Assert(_negHorizontalOffset == GetNegHorizontalOffsetFromHorizontalOffset(_horizontalOffset), "Expected _negHorizontalOffset equals GetNegHorizontalOffsetFromHorizontalOffset(_horizontalOffset).");
|
||||
DiagnosticsDebug.Assert(_negHorizontalOffset == GetNegHorizontalOffsetFromHorizontalOffset(_horizontalOffset), "Expected _negHorizontalOffset equals GetNegHorizontalOffsetFromHorizontalOffset(_horizontalOffset).");
|
||||
}
|
||||
|
||||
// update the number of visible columns to the new reality
|
||||
Debug.Assert(numVisibleScrollingCols <= visibleScrollingColumnsTmp, "Expected numVisibleScrollingCols less than or equal to visibleScrollingColumnsTmp.");
|
||||
DiagnosticsDebug.Assert(numVisibleScrollingCols <= visibleScrollingColumnsTmp, "Expected numVisibleScrollingCols less than or equal to visibleScrollingColumnsTmp.");
|
||||
numVisibleScrollingCols = visibleScrollingColumnsTmp;
|
||||
}
|
||||
|
||||
|
@ -1272,7 +1274,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
jumpFromFirstVisibleScrollingCol--;
|
||||
}
|
||||
|
||||
Debug.Assert(jumpFromFirstVisibleScrollingCol >= -1, "Expected jumpFromFirstVisibleScrollingCol greater than or equal to -1.");
|
||||
DiagnosticsDebug.Assert(jumpFromFirstVisibleScrollingCol >= -1, "Expected jumpFromFirstVisibleScrollingCol greater than or equal to -1.");
|
||||
|
||||
if (jumpFromFirstVisibleScrollingCol < 0)
|
||||
{
|
||||
|
@ -1280,12 +1282,12 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
}
|
||||
else
|
||||
{
|
||||
Debug.Assert(firstDisplayedScrollingCol >= 0, "Expected positive firstDisplayedScrollingCol.");
|
||||
DiagnosticsDebug.Assert(firstDisplayedScrollingCol >= 0, "Expected positive firstDisplayedScrollingCol.");
|
||||
dataGridColumn = this.ColumnsItemsInternal[firstDisplayedScrollingCol];
|
||||
for (int jump = 0; jump < jumpFromFirstVisibleScrollingCol; jump++)
|
||||
{
|
||||
dataGridColumn = this.ColumnsInternal.GetNextVisibleColumn(dataGridColumn);
|
||||
Debug.Assert(dataGridColumn != null, "Expected non-null dataGridColumn.");
|
||||
DiagnosticsDebug.Assert(dataGridColumn != null, "Expected non-null dataGridColumn.");
|
||||
}
|
||||
|
||||
this.DisplayData.LastTotallyDisplayedScrollingCol = dataGridColumn.Index;
|
||||
|
@ -1332,7 +1334,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
|
||||
if (dataGridColumn == null)
|
||||
{
|
||||
Debug.Assert(cx <= _horizontalOffset, "Expected cx less than or equal to _horizontalOffset.");
|
||||
DiagnosticsDebug.Assert(cx <= _horizontalOffset, "Expected cx less than or equal to _horizontalOffset.");
|
||||
dataGridColumn = this.ColumnsInternal.FirstVisibleScrollingColumn;
|
||||
if (dataGridColumn == null)
|
||||
{
|
||||
|
@ -1360,10 +1362,10 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
{
|
||||
// Column indexes have already been adjusted.
|
||||
// This column has already been detached and has retained its old Index and DisplayIndex
|
||||
Debug.Assert(deletedColumn != null, "Expected non-null deletedColumn.");
|
||||
Debug.Assert(deletedColumn.OwningGrid == null, "Expected null deletedColumn.OwningGrid.");
|
||||
Debug.Assert(deletedColumn.Index >= 0, "Expected positive deletedColumn.Index.");
|
||||
Debug.Assert(deletedColumn.DisplayIndexWithFiller >= 0, "Expected positive deletedColumn.DisplayIndexWithFiller.");
|
||||
DiagnosticsDebug.Assert(deletedColumn != null, "Expected non-null deletedColumn.");
|
||||
DiagnosticsDebug.Assert(deletedColumn.OwningGrid == null, "Expected null deletedColumn.OwningGrid.");
|
||||
DiagnosticsDebug.Assert(deletedColumn.Index >= 0, "Expected positive deletedColumn.Index.");
|
||||
DiagnosticsDebug.Assert(deletedColumn.DisplayIndexWithFiller >= 0, "Expected positive deletedColumn.DisplayIndexWithFiller.");
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -1389,7 +1391,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
}
|
||||
|
||||
#if DEBUG
|
||||
Debug.Assert(this.ColumnsInternal.Debug_VerifyColumnDisplayIndexes(), "Expected ColumnsInternal.Debug_VerifyColumnDisplayIndexes() is true.");
|
||||
DiagnosticsDebug.Assert(this.ColumnsInternal.Debug_VerifyColumnDisplayIndexes(), "Expected ColumnsInternal.Debug_VerifyColumnDisplayIndexes() is true.");
|
||||
#endif
|
||||
|
||||
// Now raise all the OnColumnDisplayIndexChanged events
|
||||
|
@ -1404,8 +1406,8 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
|
||||
private void CorrectColumnDisplayIndexesAfterInsertion(DataGridColumn insertedColumn)
|
||||
{
|
||||
Debug.Assert(insertedColumn != null, "Expected non-null insertedColumn.");
|
||||
Debug.Assert(insertedColumn.OwningGrid == this, "Expected insertedColumn.OwningGrid equals this DataGrid.");
|
||||
DiagnosticsDebug.Assert(insertedColumn != null, "Expected non-null insertedColumn.");
|
||||
DiagnosticsDebug.Assert(insertedColumn.OwningGrid == this, "Expected insertedColumn.OwningGrid equals this DataGrid.");
|
||||
if (insertedColumn.DisplayIndexWithFiller == -1 || insertedColumn.DisplayIndexWithFiller >= this.ColumnsItemsInternal.Count)
|
||||
{
|
||||
// Developer did not assign a DisplayIndex or picked a large number.
|
||||
|
@ -1438,7 +1440,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
this.ColumnsInternal.DisplayIndexMap.Insert(insertedColumn.DisplayIndexWithFiller, insertedColumn.Index);
|
||||
|
||||
#if DEBUG
|
||||
Debug.Assert(this.ColumnsInternal.Debug_VerifyColumnDisplayIndexes(), "Expected ColumnsInternal.Debug_VerifyColumnDisplayIndexes() is true.");
|
||||
DiagnosticsDebug.Assert(this.ColumnsInternal.Debug_VerifyColumnDisplayIndexes(), "Expected ColumnsInternal.Debug_VerifyColumnDisplayIndexes() is true.");
|
||||
#endif
|
||||
|
||||
// Now raise all the OnColumnDisplayIndexChanged events
|
||||
|
@ -1484,18 +1486,18 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
|
||||
private void CorrectColumnIndexesAfterDeletion(DataGridColumn deletedColumn)
|
||||
{
|
||||
Debug.Assert(deletedColumn != null, "Expected non-null deletedColumn.");
|
||||
DiagnosticsDebug.Assert(deletedColumn != null, "Expected non-null deletedColumn.");
|
||||
for (int columnIndex = deletedColumn.Index; columnIndex < this.ColumnsItemsInternal.Count; columnIndex++)
|
||||
{
|
||||
this.ColumnsItemsInternal[columnIndex].Index = this.ColumnsItemsInternal[columnIndex].Index - 1;
|
||||
Debug.Assert(this.ColumnsItemsInternal[columnIndex].Index == columnIndex, "Expected ColumnsItemsInternal[columnIndex].Index equals columnIndex.");
|
||||
DiagnosticsDebug.Assert(this.ColumnsItemsInternal[columnIndex].Index == columnIndex, "Expected ColumnsItemsInternal[columnIndex].Index equals columnIndex.");
|
||||
}
|
||||
}
|
||||
|
||||
private void CorrectColumnIndexesAfterInsertion(DataGridColumn insertedColumn, int insertionCount)
|
||||
{
|
||||
Debug.Assert(insertedColumn != null, "Expected non-null insertedColumn.");
|
||||
Debug.Assert(insertionCount > 0, "Expected strictly positive insertionCount.");
|
||||
DiagnosticsDebug.Assert(insertedColumn != null, "Expected non-null insertedColumn.");
|
||||
DiagnosticsDebug.Assert(insertionCount > 0, "Expected strictly positive insertionCount.");
|
||||
for (int columnIndex = insertedColumn.Index + insertionCount; columnIndex < this.ColumnsItemsInternal.Count; columnIndex++)
|
||||
{
|
||||
this.ColumnsItemsInternal[columnIndex].Index = columnIndex;
|
||||
|
@ -1549,7 +1551,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
column.DisplayIndexHasChanged = false;
|
||||
if (raiseEvent)
|
||||
{
|
||||
Debug.Assert(column != this.ColumnsInternal.RowGroupSpacerColumn, "Expected column other than ColumnsInternal.RowGroupSpacerColumn.");
|
||||
DiagnosticsDebug.Assert(column != this.ColumnsInternal.RowGroupSpacerColumn, "Expected column other than ColumnsInternal.RowGroupSpacerColumn.");
|
||||
OnColumnDisplayIndexChanged(column);
|
||||
}
|
||||
}
|
||||
|
@ -1630,7 +1632,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
|
||||
private bool GetColumnEffectiveReadOnlyState(DataGridColumn dataGridColumn)
|
||||
{
|
||||
Debug.Assert(dataGridColumn != null, "Expected non-null dataGridColumn.");
|
||||
DiagnosticsDebug.Assert(dataGridColumn != null, "Expected non-null dataGridColumn.");
|
||||
|
||||
return this.IsReadOnly || dataGridColumn.IsReadOnly || dataGridColumn is DataGridFillerColumn;
|
||||
}
|
||||
|
@ -1643,8 +1645,8 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
/// <returns>Absolute coordinate of the left edge of the given column.</returns>
|
||||
private double GetColumnXFromIndex(int index)
|
||||
{
|
||||
Debug.Assert(index < this.ColumnsItemsInternal.Count, "Expected index smaller than this.ColumnsItemsInternal.Count.");
|
||||
Debug.Assert(this.ColumnsItemsInternal[index].IsVisible, "Expected ColumnsItemsInternal[index].IsVisible is true.");
|
||||
DiagnosticsDebug.Assert(index < this.ColumnsItemsInternal.Count, "Expected index smaller than this.ColumnsItemsInternal.Count.");
|
||||
DiagnosticsDebug.Assert(this.ColumnsItemsInternal[index].IsVisible, "Expected ColumnsItemsInternal[index].IsVisible is true.");
|
||||
|
||||
double x = 0;
|
||||
foreach (DataGridColumn column in this.ColumnsInternal.GetVisibleColumns())
|
||||
|
@ -1715,11 +1717,11 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
|
||||
private void InsertDisplayedColumnHeader(DataGridColumn dataGridColumn)
|
||||
{
|
||||
Debug.Assert(dataGridColumn != null, "Expected non-null dataGridColumn.");
|
||||
DiagnosticsDebug.Assert(dataGridColumn != null, "Expected non-null dataGridColumn.");
|
||||
if (_columnHeadersPresenter != null)
|
||||
{
|
||||
dataGridColumn.HeaderCell.Visibility = dataGridColumn.Visibility;
|
||||
Debug.Assert(!_columnHeadersPresenter.Children.Contains(dataGridColumn.HeaderCell), "Expected dataGridColumn.HeaderCell not contained in _columnHeadersPresenter.Children.");
|
||||
DiagnosticsDebug.Assert(!_columnHeadersPresenter.Children.Contains(dataGridColumn.HeaderCell), "Expected dataGridColumn.HeaderCell not contained in _columnHeadersPresenter.Children.");
|
||||
_columnHeadersPresenter.Children.Insert(dataGridColumn.DisplayIndexWithFiller, dataGridColumn.HeaderCell);
|
||||
}
|
||||
}
|
||||
|
@ -1755,8 +1757,8 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
|
||||
private bool ScrollColumnIntoView(int columnIndex)
|
||||
{
|
||||
Debug.Assert(columnIndex >= 0, "Expected positive columnIndex.");
|
||||
Debug.Assert(columnIndex < this.ColumnsItemsInternal.Count, "Expected columnIndex smaller than this.ColumnsItemsInternal.Count.");
|
||||
DiagnosticsDebug.Assert(columnIndex >= 0, "Expected positive columnIndex.");
|
||||
DiagnosticsDebug.Assert(columnIndex < this.ColumnsItemsInternal.Count, "Expected columnIndex smaller than this.ColumnsItemsInternal.Count.");
|
||||
|
||||
if (this.DisplayData.FirstDisplayedScrollingCol != -1 &&
|
||||
!this.ColumnsItemsInternal[columnIndex].IsFrozen &&
|
||||
|
@ -1849,7 +1851,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
}
|
||||
}
|
||||
|
||||
Debug.Assert(this.DisplayData.FirstDisplayedScrollingCol >= 0, "Expected positive DisplayData.FirstDisplayedScrollingCol.");
|
||||
DiagnosticsDebug.Assert(this.DisplayData.FirstDisplayedScrollingCol >= 0, "Expected positive DisplayData.FirstDisplayedScrollingCol.");
|
||||
dataGridColumnTmp = this.ColumnsItemsInternal[this.DisplayData.FirstDisplayedScrollingCol];
|
||||
colCount = 0;
|
||||
while (colCount < columns && dataGridColumnTmp != null)
|
||||
|
@ -1863,7 +1865,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
|
||||
if (columns < 0)
|
||||
{
|
||||
Debug.Assert(this.DisplayData.FirstDisplayedScrollingCol >= 0, "Expected positive DisplayData.FirstDisplayedScrollingCol.");
|
||||
DiagnosticsDebug.Assert(this.DisplayData.FirstDisplayedScrollingCol >= 0, "Expected positive DisplayData.FirstDisplayedScrollingCol.");
|
||||
dataGridColumnTmp = this.ColumnsItemsInternal[this.DisplayData.FirstDisplayedScrollingCol];
|
||||
if (_negHorizontalOffset > 0)
|
||||
{
|
||||
|
|
|
@ -18,6 +18,8 @@ using Windows.Foundation;
|
|||
using Windows.Foundation.Collections;
|
||||
using Windows.UI.Xaml.Data;
|
||||
|
||||
using DiagnosticsDebug = System.Diagnostics.Debug;
|
||||
|
||||
namespace Microsoft.Toolkit.Uwp.UI.Controls.DataGridInternals
|
||||
{
|
||||
internal class DataGridDataConnection
|
||||
|
@ -332,7 +334,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls.DataGridInternals
|
|||
|
||||
public static bool CanEdit(Type type)
|
||||
{
|
||||
Debug.Assert(type != null, "Expected non-null type.");
|
||||
DiagnosticsDebug.Assert(type != null, "Expected non-null type.");
|
||||
|
||||
type = type.GetNonNullableType();
|
||||
|
||||
|
@ -488,7 +490,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls.DataGridInternals
|
|||
// Assumes index >= 0, returns null if index >= Count
|
||||
public object GetDataItem(int index)
|
||||
{
|
||||
Debug.Assert(index >= 0, "Expected positive index.");
|
||||
DiagnosticsDebug.Assert(index >= 0, "Expected positive index.");
|
||||
|
||||
IList list = this.List;
|
||||
if (list != null)
|
||||
|
@ -606,7 +608,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls.DataGridInternals
|
|||
|
||||
public void LoadMoreItems(uint count)
|
||||
{
|
||||
Debug.Assert(_loadingOperation == null, "Expected _loadingOperation == null.");
|
||||
DiagnosticsDebug.Assert(_loadingOperation == null, "Expected _loadingOperation == null.");
|
||||
|
||||
_loadingOperation = _incrementalItemsSource.LoadMoreItemsAsync(count);
|
||||
|
||||
|
@ -633,8 +635,8 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls.DataGridInternals
|
|||
#endif
|
||||
internal static ICollectionView CreateView(IEnumerable source)
|
||||
{
|
||||
Debug.Assert(source != null, "source unexpectedly null");
|
||||
Debug.Assert(!(source is ICollectionView), "source is an ICollectionView");
|
||||
DiagnosticsDebug.Assert(source != null, "source unexpectedly null");
|
||||
DiagnosticsDebug.Assert(!(source is ICollectionView), "source is an ICollectionView");
|
||||
|
||||
ICollectionView collectionView = null;
|
||||
|
||||
|
@ -894,8 +896,8 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls.DataGridInternals
|
|||
switch (e.Action)
|
||||
{
|
||||
case NotifyCollectionChangedAction.Add:
|
||||
Debug.Assert(e.NewItems != null, "Unexpected NotifyCollectionChangedAction.Add notification");
|
||||
Debug.Assert(this.ShouldAutoGenerateColumns || this.IsGrouping || e.NewItems.Count == 1, "Expected NewItems.Count equals 1.");
|
||||
DiagnosticsDebug.Assert(e.NewItems != null, "Unexpected NotifyCollectionChangedAction.Add notification");
|
||||
DiagnosticsDebug.Assert(this.ShouldAutoGenerateColumns || this.IsGrouping || e.NewItems.Count == 1, "Expected NewItems.Count equals 1.");
|
||||
NotifyingDataSource_Add(e.NewStartingIndex);
|
||||
break;
|
||||
|
||||
|
@ -903,7 +905,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls.DataGridInternals
|
|||
IList removedItems = e.OldItems;
|
||||
if (removedItems == null || e.OldStartingIndex < 0)
|
||||
{
|
||||
Debug.Assert(false, "Unexpected NotifyCollectionChangedAction.Remove notification");
|
||||
DiagnosticsDebug.Assert(false, "Unexpected NotifyCollectionChangedAction.Remove notification");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -913,7 +915,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls.DataGridInternals
|
|||
// Remove is a single item operation.
|
||||
foreach (object item in removedItems)
|
||||
{
|
||||
Debug.Assert(item != null, "Expected non-null item.");
|
||||
DiagnosticsDebug.Assert(item != null, "Expected non-null item.");
|
||||
_owner.RemoveRowAt(e.OldStartingIndex, item);
|
||||
}
|
||||
}
|
||||
|
@ -1019,7 +1021,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls.DataGridInternals
|
|||
if (this.DataSource != null && dataType != null && !DataTypeIsPrimitive(dataType))
|
||||
{
|
||||
_dataProperties = dataType.GetProperties(BindingFlags.Public | BindingFlags.Instance);
|
||||
Debug.Assert(_dataProperties != null, "Expected non-null _dataProperties.");
|
||||
DiagnosticsDebug.Assert(_dataProperties != null, "Expected non-null _dataProperties.");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -7,6 +7,8 @@ using System.Diagnostics;
|
|||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Media;
|
||||
|
||||
using DiagnosticsDebug = System.Diagnostics.Debug;
|
||||
|
||||
namespace Microsoft.Toolkit.Uwp.UI.Controls.DataGridInternals
|
||||
{
|
||||
internal class DataGridDisplayData
|
||||
|
@ -80,7 +82,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls.DataGridInternals
|
|||
|
||||
internal void AddRecylableRow(DataGridRow row)
|
||||
{
|
||||
Debug.Assert(!_recyclableRows.Contains(row), "Expected row parameter to be non-recyclable.");
|
||||
DiagnosticsDebug.Assert(!_recyclableRows.Contains(row), "Expected row parameter to be non-recyclable.");
|
||||
|
||||
row.DetachFromDataGrid(true);
|
||||
_recyclableRows.Push(row);
|
||||
|
@ -88,7 +90,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls.DataGridInternals
|
|||
|
||||
internal void AddRecylableRowGroupHeader(DataGridRowGroupHeader groupHeader)
|
||||
{
|
||||
Debug.Assert(!_recyclableGroupHeaders.Contains(groupHeader), "Expected groupHeader parameter to be non-recyclable.");
|
||||
DiagnosticsDebug.Assert(!_recyclableGroupHeaders.Contains(groupHeader), "Expected groupHeader parameter to be non-recyclable.");
|
||||
|
||||
groupHeader.PropertyName = null;
|
||||
groupHeader.PropertyValue = null;
|
||||
|
@ -173,7 +175,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls.DataGridInternals
|
|||
}
|
||||
else if ((_owner.GetPreviousVisibleSlot(slot) <= this.LastScrollingSlot) || (this.LastScrollingSlot == -1))
|
||||
{
|
||||
Debug.Assert(element != null, "Expected non-null element.");
|
||||
DiagnosticsDebug.Assert(element != null, "Expected non-null element.");
|
||||
|
||||
// The row was inserted in our viewport, add it as a scrolling row
|
||||
LoadScrollingSlot(slot, element, true /*updateSlotInformation*/);
|
||||
|
@ -192,9 +194,9 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls.DataGridInternals
|
|||
while (_recyclableRows.Count > 0)
|
||||
{
|
||||
DataGridRow row = _recyclableRows.Pop();
|
||||
Debug.Assert(row != null, "Expected non-null row.");
|
||||
DiagnosticsDebug.Assert(row != null, "Expected non-null row.");
|
||||
row.Visibility = Visibility.Collapsed;
|
||||
Debug.Assert(!_fullyRecycledRows.Contains(row), "Expected row not in _fullyRecycledRows.");
|
||||
DiagnosticsDebug.Assert(!_fullyRecycledRows.Contains(row), "Expected row not in _fullyRecycledRows.");
|
||||
_fullyRecycledRows.Push(row);
|
||||
}
|
||||
|
||||
|
@ -202,17 +204,17 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls.DataGridInternals
|
|||
while (_recyclableGroupHeaders.Count > 0)
|
||||
{
|
||||
DataGridRowGroupHeader groupHeader = _recyclableGroupHeaders.Pop();
|
||||
Debug.Assert(groupHeader != null, "Expected non-null groupHeader.");
|
||||
DiagnosticsDebug.Assert(groupHeader != null, "Expected non-null groupHeader.");
|
||||
groupHeader.Visibility = Visibility.Collapsed;
|
||||
Debug.Assert(!_fullyRecycledGroupHeaders.Contains(groupHeader), "Expected groupHeader not in _fullyRecycledGroupHeaders.");
|
||||
DiagnosticsDebug.Assert(!_fullyRecycledGroupHeaders.Contains(groupHeader), "Expected groupHeader not in _fullyRecycledGroupHeaders.");
|
||||
_fullyRecycledGroupHeaders.Push(groupHeader);
|
||||
}
|
||||
}
|
||||
|
||||
internal UIElement GetDisplayedElement(int slot)
|
||||
{
|
||||
Debug.Assert(slot >= this.FirstScrollingSlot, "Expected slot greater than or equal to FirstScrollingSlot.");
|
||||
Debug.Assert(slot <= this.LastScrollingSlot, "Expected slot less than or equal to LastScrollingSlot.");
|
||||
DiagnosticsDebug.Assert(slot >= this.FirstScrollingSlot, "Expected slot greater than or equal to FirstScrollingSlot.");
|
||||
DiagnosticsDebug.Assert(slot <= this.LastScrollingSlot, "Expected slot less than or equal to LastScrollingSlot.");
|
||||
|
||||
return _scrollingElements[GetCircularListIndex(slot, true /*wrap*/)];
|
||||
}
|
||||
|
@ -282,8 +284,8 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls.DataGridInternals
|
|||
else
|
||||
{
|
||||
// The slot should be adjacent to the other slots being displayed
|
||||
Debug.Assert(slot >= _owner.GetPreviousVisibleSlot(this.FirstScrollingSlot), "Expected slot greater than or equal to _owner.GetPreviousVisibleSlot(this.FirstScrollingSlot).");
|
||||
Debug.Assert(slot <= _owner.GetNextVisibleSlot(this.LastScrollingSlot), "Expected slot smaller than or equal to _owner.GetNextVisibleSlot(this.LastScrollingSlot).");
|
||||
DiagnosticsDebug.Assert(slot >= _owner.GetPreviousVisibleSlot(this.FirstScrollingSlot), "Expected slot greater than or equal to _owner.GetPreviousVisibleSlot(this.FirstScrollingSlot).");
|
||||
DiagnosticsDebug.Assert(slot <= _owner.GetNextVisibleSlot(this.LastScrollingSlot), "Expected slot smaller than or equal to _owner.GetNextVisibleSlot(this.LastScrollingSlot).");
|
||||
if (updateSlotInformation)
|
||||
{
|
||||
if (slot < this.FirstScrollingSlot)
|
||||
|
@ -324,7 +326,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls.DataGridInternals
|
|||
// Stops tracking the element at the given slot as a scrolling element
|
||||
internal void UnloadScrollingElement(int slot, bool updateSlotInformation, bool wasDeleted)
|
||||
{
|
||||
Debug.Assert(_owner.IsSlotVisible(slot), "Expected slot is visible.");
|
||||
DiagnosticsDebug.Assert(_owner.IsSlotVisible(slot), "Expected slot is visible.");
|
||||
|
||||
int elementIndex = GetCircularListIndex(slot, false /*wrap*/);
|
||||
if (elementIndex > _scrollingElements.Count)
|
||||
|
|
|
@ -6,6 +6,8 @@ using System.Diagnostics;
|
|||
using Microsoft.Toolkit.Uwp.UI.Controls.Primitives;
|
||||
using Windows.UI.Xaml;
|
||||
|
||||
using DiagnosticsDebug = System.Diagnostics.Debug;
|
||||
|
||||
namespace Microsoft.Toolkit.Uwp.UI.Controls
|
||||
{
|
||||
internal class DataGridFillerColumn : DataGridColumn
|
||||
|
@ -66,7 +68,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
|
||||
protected override object PrepareCellForEdit(FrameworkElement editingElement, RoutedEventArgs editingEventArgs)
|
||||
{
|
||||
Debug.Assert(false, "Unexpected call to DataGridFillerColumn.PrepareCellForEdit.");
|
||||
DiagnosticsDebug.Assert(false, "Unexpected call to DataGridFillerColumn.PrepareCellForEdit.");
|
||||
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -20,6 +20,8 @@ using Windows.UI.Xaml.Input;
|
|||
using Windows.UI.Xaml.Media;
|
||||
using Windows.UI.Xaml.Shapes;
|
||||
|
||||
using DiagnosticsDebug = System.Diagnostics.Debug;
|
||||
|
||||
namespace Microsoft.Toolkit.Uwp.UI.Controls
|
||||
{
|
||||
/// <summary>
|
||||
|
@ -216,9 +218,9 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
private static void OnDetailsTemplatePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
DataGridRow source = d as DataGridRow;
|
||||
Debug.Assert(source != null, "The source is not an instance of DataGridRow!");
|
||||
DiagnosticsDebug.Assert(source != null, "The source is not an instance of DataGridRow!");
|
||||
|
||||
Debug.Assert(
|
||||
DiagnosticsDebug.Assert(
|
||||
(e.NewValue == null) ||
|
||||
typeof(DataTemplate).IsInstanceOfType(e.NewValue),
|
||||
"The e.NewValue is not an instance of DataTemplate.");
|
||||
|
@ -453,7 +455,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
{
|
||||
get
|
||||
{
|
||||
Debug.Assert(this.OwningGrid != null, "Expected non-null owning DataGrid.");
|
||||
DiagnosticsDebug.Assert(this.OwningGrid != null, "Expected non-null owning DataGrid.");
|
||||
|
||||
if (_fillerCell == null)
|
||||
{
|
||||
|
@ -579,7 +581,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
return false;
|
||||
}
|
||||
|
||||
Debug.Assert(this.Index != -1, "Expected Index other than -1.");
|
||||
DiagnosticsDebug.Assert(this.Index != -1, "Expected Index other than -1.");
|
||||
return this.OwningGrid.GetRowSelection(this.Slot);
|
||||
}
|
||||
}
|
||||
|
@ -616,8 +618,8 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
this.EnsureMeasured();
|
||||
if (_detailsElement != null && _appliedDetailsVisibility == Visibility.Visible && _appliedDetailsTemplate != null)
|
||||
{
|
||||
Debug.Assert(!double.IsNaN(_detailsElement.ContentHeight), "Expected _detailsElement.ContentHeight different from double.NaN.");
|
||||
Debug.Assert(!double.IsNaN(_detailsDesiredHeight), "Expected _detailsDesiredHeight different from double.NaN.");
|
||||
DiagnosticsDebug.Assert(!double.IsNaN(_detailsElement.ContentHeight), "Expected _detailsElement.ContentHeight different from double.NaN.");
|
||||
DiagnosticsDebug.Assert(!double.IsNaN(_detailsDesiredHeight), "Expected _detailsDesiredHeight different from double.NaN.");
|
||||
return this.DesiredSize.Height + _detailsDesiredHeight - _detailsElement.ContentHeight;
|
||||
}
|
||||
else
|
||||
|
@ -634,7 +636,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
{
|
||||
get
|
||||
{
|
||||
Debug.Assert(this.OwningGrid != null, "Expected non-null owning DataGrid.");
|
||||
DiagnosticsDebug.Assert(this.OwningGrid != null, "Expected non-null owning DataGrid.");
|
||||
DataTemplate currentDetailsTemplate = this.DetailsTemplate;
|
||||
|
||||
return currentDetailsTemplate != null ? currentDetailsTemplate : this.OwningGrid.RowDetailsTemplate;
|
||||
|
@ -976,7 +978,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
{
|
||||
if (this.RootElement != null && this.OwningGrid != null && this.Visibility == Visibility.Visible)
|
||||
{
|
||||
Debug.Assert(this.Index != -1, "Expected Index other than -1.");
|
||||
DiagnosticsDebug.Assert(this.Index != -1, "Expected Index other than -1.");
|
||||
byte idealStateMappingIndex = 0;
|
||||
if (this.IsSelected || this.IsEditing)
|
||||
{
|
||||
|
@ -999,7 +1001,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
}
|
||||
|
||||
byte stateCode = _idealStateMapping[idealStateMappingIndex];
|
||||
Debug.Assert(stateCode != DATAGRIDROW_stateNullCode, "stateCode other than DATAGRIDROW_stateNullCode.");
|
||||
DiagnosticsDebug.Assert(stateCode != DATAGRIDROW_stateNullCode, "stateCode other than DATAGRIDROW_stateNullCode.");
|
||||
|
||||
string storyboardName;
|
||||
while (stateCode != DATAGRIDROW_stateNullCode)
|
||||
|
@ -1077,7 +1079,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
// Inherit the DataGrid's RowBackground properties only if this row doesn't explicitly have a background set
|
||||
if (this.RootElement != null && this.OwningGrid != null)
|
||||
{
|
||||
Debug.Assert(this.Index != -1, "Expected Index other than -1.");
|
||||
DiagnosticsDebug.Assert(this.Index != -1, "Expected Index other than -1.");
|
||||
|
||||
Brush newBackground = null;
|
||||
if (this.Background == null)
|
||||
|
@ -1118,7 +1120,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
// Inherit the DataGrid's RowForeground properties only if this row doesn't explicitly have a foreground set
|
||||
if (this.OwningGrid != null)
|
||||
{
|
||||
Debug.Assert(this.Index != -1, "Expected Index other than -1.");
|
||||
DiagnosticsDebug.Assert(this.Index != -1, "Expected Index other than -1.");
|
||||
|
||||
PropertyMetadata metadataInfo = DataGridRow.ForegroundProperty.GetMetadata(typeof(DataGridRow));
|
||||
Brush defaultForeground = metadataInfo == null ? null : metadataInfo.DefaultValue as Brush;
|
||||
|
@ -1246,8 +1248,8 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
Visibility visibility,
|
||||
bool raiseNotification)
|
||||
{
|
||||
Debug.Assert(this.OwningGrid != null, "Expected non-null owning DataGrid.");
|
||||
Debug.Assert(this.Index != -1, "Expected Index other than -1.");
|
||||
DiagnosticsDebug.Assert(this.OwningGrid != null, "Expected non-null owning DataGrid.");
|
||||
DiagnosticsDebug.Assert(this.Index != -1, "Expected Index other than -1.");
|
||||
|
||||
if (_appliedDetailsVisibility != visibility)
|
||||
{
|
||||
|
@ -1411,12 +1413,12 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
// height we want to animate to. Subsequently, we just update that height in response to SizeChanged.
|
||||
private void EnsureDetailsDesiredHeight()
|
||||
{
|
||||
Debug.Assert(_detailsElement != null, "Expected non-null _detailsElement.");
|
||||
Debug.Assert(this.OwningGrid != null, "Expected non-null owning DataGrid.");
|
||||
DiagnosticsDebug.Assert(_detailsElement != null, "Expected non-null _detailsElement.");
|
||||
DiagnosticsDebug.Assert(this.OwningGrid != null, "Expected non-null owning DataGrid.");
|
||||
|
||||
if (_detailsContent != null)
|
||||
{
|
||||
Debug.Assert(_detailsElement.Children.Contains(_detailsContent), "Expected _detailsElement parent of _detailsContent.");
|
||||
DiagnosticsDebug.Assert(_detailsElement.Children.Contains(_detailsContent), "Expected _detailsElement parent of _detailsContent.");
|
||||
|
||||
_detailsContent.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
|
||||
_detailsDesiredHeight = _detailsContent.DesiredSize.Height;
|
||||
|
|
|
@ -21,6 +21,8 @@ using Windows.UI.Xaml.Input;
|
|||
using Windows.UI.Xaml.Media;
|
||||
using Windows.UI.Xaml.Shapes;
|
||||
|
||||
using DiagnosticsDebug = System.Diagnostics.Debug;
|
||||
|
||||
namespace Microsoft.Toolkit.Uwp.UI.Controls
|
||||
{
|
||||
/// <summary>
|
||||
|
@ -281,7 +283,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
{
|
||||
get
|
||||
{
|
||||
Debug.Assert(this.OwningGrid != null, "Expected non-null OwningGrid.");
|
||||
DiagnosticsDebug.Assert(this.OwningGrid != null, "Expected non-null OwningGrid.");
|
||||
return this.RowGroupInfo.Slot == this.OwningGrid.CurrentSlot;
|
||||
}
|
||||
}
|
||||
|
@ -459,7 +461,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
if (!e.Handled && this.OwningGrid.IsTabStop)
|
||||
{
|
||||
bool success = this.OwningGrid.Focus(FocusState.Programmatic);
|
||||
Debug.Assert(success, "Expected successful focus change.");
|
||||
DiagnosticsDebug.Assert(success, "Expected successful focus change.");
|
||||
}
|
||||
|
||||
e.Handled = this.OwningGrid.UpdateStateOnTapped(e, this.OwningGrid.CurrentColumnIndex, this.RowGroupInfo.Slot, false /*allowEdit*/);
|
||||
|
|
|
@ -13,6 +13,8 @@ using Windows.UI.Xaml.Controls;
|
|||
using Windows.UI.Xaml.Input;
|
||||
using Windows.UI.Xaml.Media;
|
||||
|
||||
using DiagnosticsDebug = System.Diagnostics.Debug;
|
||||
|
||||
namespace Microsoft.Toolkit.Uwp.UI.Controls.Primitives
|
||||
{
|
||||
/// <summary>
|
||||
|
@ -368,7 +370,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls.Primitives
|
|||
}
|
||||
|
||||
byte stateCode = _idealStateMapping[idealStateMappingIndex];
|
||||
Debug.Assert(stateCode != DATAGRIDROWHEADER_stateNullCode, "Expected stateCode other than DATAGRIDROWHEADER_stateNullCode.");
|
||||
DiagnosticsDebug.Assert(stateCode != DATAGRIDROWHEADER_stateNullCode, "Expected stateCode other than DATAGRIDROWHEADER_stateNullCode.");
|
||||
|
||||
string storyboardName;
|
||||
while (stateCode != DATAGRIDROWHEADER_stateNullCode)
|
||||
|
@ -426,13 +428,13 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls.Primitives
|
|||
if (!e.Handled && this.OwningGrid.IsTabStop)
|
||||
{
|
||||
bool success = this.OwningGrid.Focus(FocusState.Programmatic);
|
||||
Debug.Assert(success, "Expected successful focus change.");
|
||||
DiagnosticsDebug.Assert(success, "Expected successful focus change.");
|
||||
}
|
||||
|
||||
if (this.OwningRow != null)
|
||||
{
|
||||
Debug.Assert(sender is DataGridRowHeader, "Expected sender is DataGridRowHeader.");
|
||||
Debug.Assert(sender == this, "Expected sender is this.");
|
||||
DiagnosticsDebug.Assert(sender is DataGridRowHeader, "Expected sender is DataGridRowHeader.");
|
||||
DiagnosticsDebug.Assert(sender == this, "Expected sender is this.");
|
||||
|
||||
e.Handled = this.OwningGrid.UpdateStateOnTapped(e, -1, this.Slot, false /*allowEdit*/);
|
||||
this.OwningGrid.UpdatedStateOnTapped = true;
|
||||
|
|
|
@ -16,6 +16,8 @@ using Windows.UI.Xaml;
|
|||
using Windows.UI.Xaml.Data;
|
||||
using Windows.UI.Xaml.Media;
|
||||
|
||||
using DiagnosticsDebug = System.Diagnostics.Debug;
|
||||
|
||||
namespace Microsoft.Toolkit.Uwp.UI.Controls
|
||||
{
|
||||
/// <summary>
|
||||
|
@ -83,9 +85,9 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
return 0;
|
||||
}
|
||||
|
||||
Debug.Assert(this.DisplayData.LastScrollingSlot >= 0, "Expected positive DisplayData.LastScrollingSlot.");
|
||||
Debug.Assert(_verticalOffset >= 0, "Expected positive _verticalOffset.");
|
||||
Debug.Assert(this.NegVerticalOffset >= 0, "Expected positive NegVerticalOffset.");
|
||||
DiagnosticsDebug.Assert(this.DisplayData.LastScrollingSlot >= 0, "Expected positive DisplayData.LastScrollingSlot.");
|
||||
DiagnosticsDebug.Assert(_verticalOffset >= 0, "Expected positive _verticalOffset.");
|
||||
DiagnosticsDebug.Assert(this.NegVerticalOffset >= 0, "Expected positive NegVerticalOffset.");
|
||||
|
||||
// Height of all rows above the viewport
|
||||
double totalRowsHeight = _verticalOffset - this.NegVerticalOffset;
|
||||
|
@ -344,7 +346,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
|
||||
internal Visibility GetRowDetailsVisibility(int rowIndex, DataGridRowDetailsVisibilityMode gridLevelRowDetailsVisibility)
|
||||
{
|
||||
Debug.Assert(rowIndex != -1, "Expected rowIndex other than -1.");
|
||||
DiagnosticsDebug.Assert(rowIndex != -1, "Expected rowIndex other than -1.");
|
||||
if (_showDetailsTable.Contains(rowIndex))
|
||||
{
|
||||
// The user explicitly set DetailsVisibility on a row so we should respect that
|
||||
|
@ -384,7 +386,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
|
||||
internal bool GetRowSelection(int slot)
|
||||
{
|
||||
Debug.Assert(slot != -1, "Expected slot other than -1.");
|
||||
DiagnosticsDebug.Assert(slot != -1, "Expected slot other than -1.");
|
||||
return _selectedItems.ContainsSlot(slot);
|
||||
}
|
||||
|
||||
|
@ -395,8 +397,8 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
DataGridRowGroupInfo groupInfo,
|
||||
bool isCollapsed)
|
||||
{
|
||||
Debug.Assert(slot >= 0, "Expected positive slot.");
|
||||
Debug.Assert(slot <= this.SlotCount, "Expected slot smaller than or equal to SlotCount.");
|
||||
DiagnosticsDebug.Assert(slot >= 0, "Expected positive slot.");
|
||||
DiagnosticsDebug.Assert(slot <= this.SlotCount, "Expected slot smaller than or equal to SlotCount.");
|
||||
|
||||
bool isRow = rowIndex != -1;
|
||||
if (isCollapsed || (this.IsReadOnly && rowIndex == this.DataConnection.NewItemPlaceholderIndex))
|
||||
|
@ -467,15 +469,15 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
|
||||
internal void OnRowDetailsVisibilityPropertyChanged(int rowIndex, Visibility visibility)
|
||||
{
|
||||
Debug.Assert(rowIndex >= 0, "Expected positive rowIndex.");
|
||||
Debug.Assert(rowIndex < this.SlotCount, "Expected rowIndex smaller than SlotCount.");
|
||||
DiagnosticsDebug.Assert(rowIndex >= 0, "Expected positive rowIndex.");
|
||||
DiagnosticsDebug.Assert(rowIndex < this.SlotCount, "Expected rowIndex smaller than SlotCount.");
|
||||
|
||||
_showDetailsTable.AddValue(rowIndex, visibility);
|
||||
}
|
||||
|
||||
internal void OnRowGroupHeaderToggled(DataGridRowGroupHeader groupHeader, Visibility newVisibility, bool setCurrent)
|
||||
{
|
||||
Debug.Assert(groupHeader.RowGroupInfo.CollectionViewGroup.GroupItems.Count > 0, "Expected positive groupHeader.RowGroupInfo.CollectionViewGroup.GroupItems.Count.");
|
||||
DiagnosticsDebug.Assert(groupHeader.RowGroupInfo.CollectionViewGroup.GroupItems.Count > 0, "Expected positive groupHeader.RowGroupInfo.CollectionViewGroup.GroupItems.Count.");
|
||||
|
||||
if (this.WaitForLostFocus(() => { this.OnRowGroupHeaderToggled(groupHeader, newVisibility, setCurrent); }) || !this.CommitEdit())
|
||||
{
|
||||
|
@ -507,17 +509,17 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
|
||||
internal void OnSublevelIndentUpdated(DataGridRowGroupHeader groupHeader, double newValue)
|
||||
{
|
||||
Debug.Assert(this.DataConnection.CollectionView != null, "Expected non-null DataConnection.CollectionView.");
|
||||
Debug.Assert(this.DataConnection.CollectionView.CollectionGroups != null, "Expected non-null DataConnection.CollectionView.CollectionGroups.");
|
||||
Debug.Assert(this.RowGroupSublevelIndents != null, "Expected non-null RowGroupSublevelIndents.");
|
||||
DiagnosticsDebug.Assert(this.DataConnection.CollectionView != null, "Expected non-null DataConnection.CollectionView.");
|
||||
DiagnosticsDebug.Assert(this.DataConnection.CollectionView.CollectionGroups != null, "Expected non-null DataConnection.CollectionView.CollectionGroups.");
|
||||
DiagnosticsDebug.Assert(this.RowGroupSublevelIndents != null, "Expected non-null RowGroupSublevelIndents.");
|
||||
|
||||
#if FEATURE_ICOLLECTIONVIEW_GROUP
|
||||
int groupLevelCount = this.DataConnection.CollectionView.GroupDescriptions.Count;
|
||||
#else
|
||||
int groupLevelCount = 1;
|
||||
#endif
|
||||
Debug.Assert(groupHeader.Level >= 0, "Expected positive groupHeader.Level.");
|
||||
Debug.Assert(groupHeader.Level < groupLevelCount, "Expected groupHeader.Level smaller than groupLevelCount.");
|
||||
DiagnosticsDebug.Assert(groupHeader.Level >= 0, "Expected positive groupHeader.Level.");
|
||||
DiagnosticsDebug.Assert(groupHeader.Level < groupLevelCount, "Expected groupHeader.Level smaller than groupLevelCount.");
|
||||
|
||||
double oldValue = this.RowGroupSublevelIndents[groupHeader.Level];
|
||||
if (groupHeader.Level > 0)
|
||||
|
@ -530,7 +532,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
for (int i = groupHeader.Level; i < groupLevelCount; i++)
|
||||
{
|
||||
this.RowGroupSublevelIndents[i] += change;
|
||||
Debug.Assert(this.RowGroupSublevelIndents[i] >= 0, "Expected positive RowGroupSublevelIndents[i].");
|
||||
DiagnosticsDebug.Assert(this.RowGroupSublevelIndents[i] >= 0, "Expected positive RowGroupSublevelIndents[i].");
|
||||
}
|
||||
|
||||
EnsureRowGroupSpacerColumnWidth(groupLevelCount);
|
||||
|
@ -629,7 +631,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
|
||||
internal bool ScrollSlotIntoView(int slot, bool scrolledHorizontally)
|
||||
{
|
||||
Debug.Assert(_collapsedSlotsTable.Contains(slot) || !IsSlotOutOfBounds(slot), "Expected _collapsedSlotsTable.Contains(slot) is true or IsSlotOutOfBounds(slot) is false.");
|
||||
DiagnosticsDebug.Assert(_collapsedSlotsTable.Contains(slot) || !IsSlotOutOfBounds(slot), "Expected _collapsedSlotsTable.Contains(slot) is true or IsSlotOutOfBounds(slot) is false.");
|
||||
|
||||
if (scrolledHorizontally && this.DisplayData.FirstScrollingSlot <= slot && this.DisplayData.LastScrollingSlot >= slot)
|
||||
{
|
||||
|
@ -745,7 +747,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
}
|
||||
|
||||
// TODO: in certain cases (eg, variable row height), this may not be true
|
||||
Debug.Assert(DoubleUtil.LessThanOrClose(this.NegVerticalOffset, _verticalOffset), "Expected NegVerticalOffset is less than or close to _verticalOffset.");
|
||||
DiagnosticsDebug.Assert(DoubleUtil.LessThanOrClose(this.NegVerticalOffset, _verticalOffset), "Expected NegVerticalOffset is less than or close to _verticalOffset.");
|
||||
|
||||
SetVerticalOffset(_verticalOffset);
|
||||
|
||||
|
@ -757,14 +759,14 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
|
||||
internal void SetRowSelection(int slot, bool isSelected, bool setAnchorSlot)
|
||||
{
|
||||
Debug.Assert(isSelected || !setAnchorSlot, "Expected isSelected is true or setAnchorSlot is false.");
|
||||
Debug.Assert(!IsSlotOutOfSelectionBounds(slot), "Expected IsSlotOutOfSelectionBounds(slot) is false.");
|
||||
DiagnosticsDebug.Assert(isSelected || !setAnchorSlot, "Expected isSelected is true or setAnchorSlot is false.");
|
||||
DiagnosticsDebug.Assert(!IsSlotOutOfSelectionBounds(slot), "Expected IsSlotOutOfSelectionBounds(slot) is false.");
|
||||
_noSelectionChangeCount++;
|
||||
try
|
||||
{
|
||||
if (this.SelectionMode == DataGridSelectionMode.Single && isSelected)
|
||||
{
|
||||
Debug.Assert(_selectedItems.Count <= 1, "Expected _selectedItems.Count smaller than or equal to 1.");
|
||||
DiagnosticsDebug.Assert(_selectedItems.Count <= 1, "Expected _selectedItems.Count smaller than or equal to 1.");
|
||||
if (_selectedItems.Count > 0)
|
||||
{
|
||||
int currentlySelectedSlot = _selectedItems.GetIndexes().First();
|
||||
|
@ -796,11 +798,11 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
// For now, all scenarios are for isSelected == true.
|
||||
internal void SetRowsSelection(int startSlot, int endSlot, bool isSelected = true)
|
||||
{
|
||||
Debug.Assert(startSlot >= 0, "Expected startSlot is positive.");
|
||||
Debug.Assert(startSlot < this.SlotCount, "Expected startSlot is smaller than SlotCount.");
|
||||
Debug.Assert(endSlot >= 0, "Expected endSlot is positive.");
|
||||
Debug.Assert(endSlot < this.SlotCount, "Expected endSlot is smaller than SlotCount.");
|
||||
Debug.Assert(startSlot <= endSlot, "Expected startSlot is smaller than or equal to endSlot.");
|
||||
DiagnosticsDebug.Assert(startSlot >= 0, "Expected startSlot is positive.");
|
||||
DiagnosticsDebug.Assert(startSlot < this.SlotCount, "Expected startSlot is smaller than SlotCount.");
|
||||
DiagnosticsDebug.Assert(endSlot >= 0, "Expected endSlot is positive.");
|
||||
DiagnosticsDebug.Assert(endSlot < this.SlotCount, "Expected endSlot is smaller than SlotCount.");
|
||||
DiagnosticsDebug.Assert(startSlot <= endSlot, "Expected startSlot is smaller than or equal to endSlot.");
|
||||
|
||||
_noSelectionChangeCount++;
|
||||
try
|
||||
|
@ -847,19 +849,19 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
DataGridRow row = element as DataGridRow;
|
||||
if (row != null)
|
||||
{
|
||||
Debug.Assert(row.OwningGrid == this, "Expected row.OwningGrid equals this DataGrid.");
|
||||
Debug.Assert(row.Cells.Count == this.ColumnsItemsInternal.Count, "Expected row.Cells.Count equals this.ColumnsItemsInternal.Count.");
|
||||
DiagnosticsDebug.Assert(row.OwningGrid == this, "Expected row.OwningGrid equals this DataGrid.");
|
||||
DiagnosticsDebug.Assert(row.Cells.Count == this.ColumnsItemsInternal.Count, "Expected row.Cells.Count equals this.ColumnsItemsInternal.Count.");
|
||||
|
||||
int columnIndex = 0;
|
||||
foreach (DataGridCell dataGridCell in row.Cells)
|
||||
{
|
||||
Debug.Assert(dataGridCell.OwningRow == row, "Expected dataGridCell.OwningRow equals row.");
|
||||
Debug.Assert(dataGridCell.OwningColumn == this.ColumnsItemsInternal[columnIndex], "Expected dataGridCell.OwningColumn equals this.ColumnsItemsInternal[columnIndex].");
|
||||
DiagnosticsDebug.Assert(dataGridCell.OwningRow == row, "Expected dataGridCell.OwningRow equals row.");
|
||||
DiagnosticsDebug.Assert(dataGridCell.OwningColumn == this.ColumnsItemsInternal[columnIndex], "Expected dataGridCell.OwningColumn equals this.ColumnsItemsInternal[columnIndex].");
|
||||
columnIndex++;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
Debug.Assert(slot == this.SlotCount, "Expected slot equals this.SlotCount.");
|
||||
DiagnosticsDebug.Assert(slot == this.SlotCount, "Expected slot equals this.SlotCount.");
|
||||
|
||||
OnAddedElement_Phase1(slot, element);
|
||||
this.SlotCount++;
|
||||
|
@ -918,7 +920,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
|
||||
if (firstSlot >= 0)
|
||||
{
|
||||
Debug.Assert(lastSlot >= firstSlot, "lastSlot greater than or equal to firstSlot.");
|
||||
DiagnosticsDebug.Assert(lastSlot >= firstSlot, "lastSlot greater than or equal to firstSlot.");
|
||||
int slot = GetNextVisibleSlot(firstSlot - 1);
|
||||
while (slot <= lastSlot)
|
||||
{
|
||||
|
@ -1107,7 +1109,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
/// </summary>
|
||||
private void CorrectSlotsAfterDeletion(int slotDeleted, bool wasRow)
|
||||
{
|
||||
Debug.Assert(slotDeleted >= 0, "Expected positive slotDeleted.");
|
||||
DiagnosticsDebug.Assert(slotDeleted >= 0, "Expected positive slotDeleted.");
|
||||
|
||||
// Take care of the non-visible loaded rows
|
||||
for (int index = 0; index < _loadedRows.Count;)
|
||||
|
@ -1187,7 +1189,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
/// </summary>
|
||||
private void CorrectSlotsAfterInsertion(int slotInserted, bool isCollapsed, bool rowInserted)
|
||||
{
|
||||
Debug.Assert(slotInserted >= 0, "Expected positive slotInserted.");
|
||||
DiagnosticsDebug.Assert(slotInserted >= 0, "Expected positive slotInserted.");
|
||||
|
||||
// Take care of the non-visible loaded rows
|
||||
foreach (DataGridRow dataGridRow in _loadedRows)
|
||||
|
@ -1314,7 +1316,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
|
||||
private void CollectionViewGroup_CollectionChanged_Remove(object sender, NotifyCollectionChangedEventArgs e)
|
||||
{
|
||||
Debug.Assert(e.OldItems.Count == 1, "Expected e.OldItems.Count equals 1.");
|
||||
DiagnosticsDebug.Assert(e.OldItems.Count == 1, "Expected e.OldItems.Count equals 1.");
|
||||
if (e.OldItems != null && e.OldItems.Count > 0)
|
||||
{
|
||||
OnCollectionViewGroupItemRemoved(sender, e.OldItems[0], e.OldStartingIndex);
|
||||
|
@ -1437,7 +1439,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
return _selectedItems.GetIndexCount(lowerBound, upperBound);
|
||||
}
|
||||
|
||||
Debug.Assert(false, "Expected known RowDetailsVisibilityMode value."); // Shouldn't ever happen
|
||||
DiagnosticsDebug.Assert(false, "Expected known RowDetailsVisibilityMode value."); // Shouldn't ever happen
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1479,7 +1481,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
if (this.IsSlotVisible(rowGroupInfo.Slot))
|
||||
{
|
||||
DataGridRowGroupHeader rowGroupHeader = this.DisplayData.GetDisplayedElement(rowGroupInfo.Slot) as DataGridRowGroupHeader;
|
||||
Debug.Assert(rowGroupHeader != null, "Expected non-null rowGroupHeader.");
|
||||
DiagnosticsDebug.Assert(rowGroupHeader != null, "Expected non-null rowGroupHeader.");
|
||||
rowGroupHeader.ToggleExpandCollapse(visibility, setCurrent);
|
||||
}
|
||||
else
|
||||
|
@ -1613,7 +1615,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
{
|
||||
if (this.EditingRow != null && this.EditingRow.Cells != null)
|
||||
{
|
||||
Debug.Assert(this.EditingRow.Cells.Count == this.ColumnsItemsInternal.Count, "Expected EditingRow.Cells.Count equals this.ColumnsItemsInternal.Count.");
|
||||
DiagnosticsDebug.Assert(this.EditingRow.Cells.Count == this.ColumnsItemsInternal.Count, "Expected EditingRow.Cells.Count equals this.ColumnsItemsInternal.Count.");
|
||||
foreach (DataGridColumn column in this.ColumnsInternal.GetDisplayedColumns(c => c.IsVisible && !c.IsReadOnly))
|
||||
{
|
||||
column.GenerateEditingElementInternal(this.EditingRow.Cells[column.Index], this.EditingRow.DataContext);
|
||||
|
@ -1636,7 +1638,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
/// <returns>A row for the provided index.</returns>
|
||||
private DataGridRow GenerateRow(int rowIndex, int slot, object dataContext)
|
||||
{
|
||||
Debug.Assert(rowIndex >= 0, "Expected positive rowIndex.");
|
||||
DiagnosticsDebug.Assert(rowIndex >= 0, "Expected positive rowIndex.");
|
||||
DataGridRow dataGridRow = GetGeneratedRow(dataContext);
|
||||
if (dataGridRow == null)
|
||||
{
|
||||
|
@ -1661,8 +1663,8 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
|
||||
private DataGridRowGroupHeader GenerateRowGroupHeader(int slot, DataGridRowGroupInfo rowGroupInfo)
|
||||
{
|
||||
Debug.Assert(slot >= 0, "Expected positive slot.");
|
||||
Debug.Assert(rowGroupInfo != null, "Expected non-null rowGroupInfo.");
|
||||
DiagnosticsDebug.Assert(slot >= 0, "Expected positive slot.");
|
||||
DiagnosticsDebug.Assert(rowGroupInfo != null, "Expected non-null rowGroupInfo.");
|
||||
|
||||
DataGridRowGroupHeader groupHeader = this.DisplayData.GetUsedGroupHeader() ?? new DataGridRowGroupHeader();
|
||||
groupHeader.OwningGrid = this;
|
||||
|
@ -1671,7 +1673,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
groupHeader.Level = rowGroupInfo.Level;
|
||||
|
||||
#if FEATURE_ICOLLECTIONVIEW_GROUP
|
||||
Debug.Assert(this.DataConnection.CollectionView != null && groupHeader.Level < this.DataConnection.CollectionView.GroupDescriptions.Count);
|
||||
DiagnosticsDebug.Assert(this.DataConnection.CollectionView != null && groupHeader.Level < this.DataConnection.CollectionView.GroupDescriptions.Count);
|
||||
PropertyGroupDescription propertyGroupDescription = this.DataConnection.CollectionView.GroupDescriptions[groupHeader.Level] as PropertyGroupDescription;
|
||||
if (propertyGroupDescription != null)
|
||||
{
|
||||
|
@ -1728,18 +1730,18 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
/// <returns>Exact row height with gridlines thickness.</returns>
|
||||
private double GetExactSlotElementHeight(int slot)
|
||||
{
|
||||
Debug.Assert(slot >= 0, "Expected positive slot.");
|
||||
Debug.Assert(slot < this.SlotCount, "Expected slot smaller than SlotCount.");
|
||||
DiagnosticsDebug.Assert(slot >= 0, "Expected positive slot.");
|
||||
DiagnosticsDebug.Assert(slot < this.SlotCount, "Expected slot smaller than SlotCount.");
|
||||
|
||||
if (this.IsSlotVisible(slot))
|
||||
{
|
||||
Debug.Assert(this.DisplayData.GetDisplayedElement(slot) != null, "Expected non-null DisplayData.GetDisplayedElement(slot).");
|
||||
DiagnosticsDebug.Assert(this.DisplayData.GetDisplayedElement(slot) != null, "Expected non-null DisplayData.GetDisplayedElement(slot).");
|
||||
return this.DisplayData.GetDisplayedElement(slot).EnsureMeasured().DesiredSize.Height;
|
||||
}
|
||||
|
||||
// InsertDisplayedElement automatically measures the element
|
||||
FrameworkElement slotElement = InsertDisplayedElement(slot, true /*updateSlotInformation*/);
|
||||
Debug.Assert(slotElement != null, "Expected non-null slotElement.");
|
||||
DiagnosticsDebug.Assert(slotElement != null, "Expected non-null slotElement.");
|
||||
return slotElement.DesiredSize.Height;
|
||||
}
|
||||
|
||||
|
@ -1807,11 +1809,11 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
/// <returns>Exact height of displayed slot, or default height otherwise.</returns>
|
||||
private double GetSlotElementHeight(int slot)
|
||||
{
|
||||
Debug.Assert(slot >= 0, "Expected positive slot.");
|
||||
Debug.Assert(slot < this.SlotCount, "Expected slot smaller than SlotCount.");
|
||||
DiagnosticsDebug.Assert(slot >= 0, "Expected positive slot.");
|
||||
DiagnosticsDebug.Assert(slot < this.SlotCount, "Expected slot smaller than SlotCount.");
|
||||
if (this.IsSlotVisible(slot))
|
||||
{
|
||||
Debug.Assert(this.DisplayData.GetDisplayedElement(slot) != null, "Expected non-null DisplayData.GetDisplayedElement(slot).");
|
||||
DiagnosticsDebug.Assert(this.DisplayData.GetDisplayedElement(slot) != null, "Expected non-null DisplayData.GetDisplayedElement(slot).");
|
||||
return this.DisplayData.GetDisplayedElement(slot).EnsureMeasured().DesiredSize.Height;
|
||||
}
|
||||
else
|
||||
|
@ -1834,7 +1836,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
/// <returns>Cumulated approximate height of the non-collapsed slots from fromSlot to toSlot inclusive including the potential gridline thickness.</returns>
|
||||
private double GetSlotElementsHeight(int fromSlot, int toSlot)
|
||||
{
|
||||
Debug.Assert(toSlot >= fromSlot, "Expected toSlot greater or equal to fromSlot.");
|
||||
DiagnosticsDebug.Assert(toSlot >= fromSlot, "Expected toSlot greater or equal to fromSlot.");
|
||||
|
||||
double height = 0;
|
||||
for (int slot = GetNextVisibleSlot(fromSlot - 1); slot <= toSlot; slot = GetNextVisibleSlot(slot))
|
||||
|
@ -1911,10 +1913,10 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
{
|
||||
// We can only support creating new rows that are adjacent to the currently visible rows
|
||||
// since they need to be added to the visual tree for us to Measure them.
|
||||
Debug.Assert(
|
||||
DiagnosticsDebug.Assert(
|
||||
this.DisplayData.FirstScrollingSlot == -1 || (slot >= GetPreviousVisibleSlot(this.DisplayData.FirstScrollingSlot) && slot <= GetNextVisibleSlot(this.DisplayData.LastScrollingSlot)),
|
||||
"Expected DisplayData.FirstScrollingSlot equals -1 or (slot greater than or equal to GetPreviousVisibleSlot(DisplayData.FirstScrollingSlot) and slot smaller than or equal to GetNextVisibleSlot(DisplayData.LastScrollingSlot)).");
|
||||
Debug.Assert(element != null, "Expected non-null element.");
|
||||
DiagnosticsDebug.Assert(element != null, "Expected non-null element.");
|
||||
|
||||
if (_rowsPresenter != null)
|
||||
{
|
||||
|
@ -1928,14 +1930,14 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
{
|
||||
if (!row.IsRecycled)
|
||||
{
|
||||
Debug.Assert(!_rowsPresenter.Children.Contains(element), "Expected element not contained in _rowsPresenter.Children.");
|
||||
DiagnosticsDebug.Assert(!_rowsPresenter.Children.Contains(element), "Expected element not contained in _rowsPresenter.Children.");
|
||||
_rowsPresenter.Children.Add(row);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
element.Clip = null;
|
||||
Debug.Assert(row.Index == RowIndexFromSlot(slot), "Expected row.Index equals RowIndexFromSlot(slot).");
|
||||
DiagnosticsDebug.Assert(row.Index == RowIndexFromSlot(slot), "Expected row.Index equals RowIndexFromSlot(slot).");
|
||||
if (!_rowsPresenter.Children.Contains(row))
|
||||
{
|
||||
_rowsPresenter.Children.Add(row);
|
||||
|
@ -1945,7 +1947,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
else
|
||||
{
|
||||
groupHeader = element as DataGridRowGroupHeader;
|
||||
Debug.Assert(groupHeader != null, "Expected non-null grouHeader.");
|
||||
DiagnosticsDebug.Assert(groupHeader != null, "Expected non-null grouHeader.");
|
||||
if (groupHeader != null)
|
||||
{
|
||||
groupHeader.TotalIndent = (groupHeader.Level == 0) ? 0 : this.RowGroupSublevelIndents[groupHeader.Level - 1];
|
||||
|
@ -1988,8 +1990,8 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
|
||||
private void InsertElement(int slot, UIElement element, bool updateVerticalScrollBarOnly, bool isCollapsed, bool isRow)
|
||||
{
|
||||
Debug.Assert(slot >= 0, "Expected positive slot.");
|
||||
Debug.Assert(slot <= this.SlotCount, "Expected slot smaller than or equal to SlotCount.");
|
||||
DiagnosticsDebug.Assert(slot >= 0, "Expected positive slot.");
|
||||
DiagnosticsDebug.Assert(slot <= this.SlotCount, "Expected slot smaller than or equal to SlotCount.");
|
||||
|
||||
OnInsertingElement(slot, true /*firstInsertion*/, isCollapsed, isRow); // will throw an exception if the insertion is illegal
|
||||
|
||||
|
@ -2011,7 +2013,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
|
||||
private void OnAddedElement_Phase1(int slot, UIElement element)
|
||||
{
|
||||
Debug.Assert(slot >= 0, "Expected positive slot.");
|
||||
DiagnosticsDebug.Assert(slot >= 0, "Expected positive slot.");
|
||||
|
||||
// Row needs to be potentially added to the displayed rows
|
||||
if (SlotIsDisplayed(slot))
|
||||
|
@ -2117,7 +2119,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
{
|
||||
// Assume we're adding a new row
|
||||
int rowIndex = this.DataConnection.IndexOf(insertedItem);
|
||||
Debug.Assert(rowIndex != -1, "Expected rowIndex other than -1.");
|
||||
DiagnosticsDebug.Assert(rowIndex != -1, "Expected rowIndex other than -1.");
|
||||
if (this.SlotCount == 0 && this.DataConnection.ShouldAutoGenerateColumns)
|
||||
{
|
||||
AutoGenerateColumnsPrivate();
|
||||
|
@ -2161,10 +2163,10 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
#endif
|
||||
|
||||
DataGridRowGroupInfo groupInfo = RowGroupInfoFromCollectionViewGroup(removedGroup);
|
||||
Debug.Assert(groupInfo != null, "Expected non-null groupInfo.");
|
||||
DiagnosticsDebug.Assert(groupInfo != null, "Expected non-null groupInfo.");
|
||||
if ((groupInfo.Level == _rowGroupHeightsByLevel.Length - 1) && (removedGroup.GroupItems != null) && (removedGroup.GroupItems.Count > 0))
|
||||
{
|
||||
Debug.Assert(groupInfo.LastSubItemSlot - groupInfo.Slot == removedGroup.GroupItems.Count, "Expected groupInfo.LastSubItemSlot - groupInfo.Slot equals removedGroup.GroupItems.Count.");
|
||||
DiagnosticsDebug.Assert(groupInfo.LastSubItemSlot - groupInfo.Slot == removedGroup.GroupItems.Count, "Expected groupInfo.LastSubItemSlot - groupInfo.Slot equals removedGroup.GroupItems.Count.");
|
||||
|
||||
// If we're removing a leaf Group then remove all of its items before removing the Group.
|
||||
for (int i = 0; i < removedGroup.GroupItems.Count; i++)
|
||||
|
@ -2219,7 +2221,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
|
||||
private void OnInsertedElement_Phase1(int slot, UIElement element, bool isCollapsed, bool isRow)
|
||||
{
|
||||
Debug.Assert(slot >= 0, "Expected positive slot.");
|
||||
DiagnosticsDebug.Assert(slot >= 0, "Expected positive slot.");
|
||||
|
||||
// Fix the Index of all following rows
|
||||
CorrectSlotsAfterInsertion(slot, isCollapsed, isRow);
|
||||
|
@ -2231,18 +2233,18 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
DataGridRow dataGridRow = element as DataGridRow;
|
||||
if (dataGridRow != null)
|
||||
{
|
||||
Debug.Assert(dataGridRow.Cells.Count == this.ColumnsItemsInternal.Count, "Expected dataGridRow.Cells.Count equals ColumnsItemsInternal.Count.");
|
||||
DiagnosticsDebug.Assert(dataGridRow.Cells.Count == this.ColumnsItemsInternal.Count, "Expected dataGridRow.Cells.Count equals ColumnsItemsInternal.Count.");
|
||||
|
||||
int columnIndex = 0;
|
||||
foreach (DataGridCell dataGridCell in dataGridRow.Cells)
|
||||
{
|
||||
Debug.Assert(dataGridCell.OwningRow == dataGridRow, "Expected dataGridRow owns dataGridCell.");
|
||||
Debug.Assert(dataGridCell.OwningColumn == this.ColumnsItemsInternal[columnIndex], "Expected ColumnsItemsInternal[columnIndex] owns dataGridCell.");
|
||||
DiagnosticsDebug.Assert(dataGridCell.OwningRow == dataGridRow, "Expected dataGridRow owns dataGridCell.");
|
||||
DiagnosticsDebug.Assert(dataGridCell.OwningColumn == this.ColumnsItemsInternal[columnIndex], "Expected ColumnsItemsInternal[columnIndex] owns dataGridCell.");
|
||||
columnIndex++;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
Debug.Assert(!isCollapsed, "Expected isCollapsed is false.");
|
||||
DiagnosticsDebug.Assert(!isCollapsed, "Expected isCollapsed is false.");
|
||||
OnAddedElement_Phase1(slot, element);
|
||||
}
|
||||
else if ((slot <= this.DisplayData.FirstScrollingSlot) || (isCollapsed && (slot <= this.DisplayData.LastScrollingSlot)))
|
||||
|
@ -2253,7 +2255,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
|
||||
private void OnInsertedElement_Phase2(int slot, bool updateVerticalScrollBarOnly, bool isCollapsed)
|
||||
{
|
||||
Debug.Assert(slot >= 0, "Expected positive slot.");
|
||||
DiagnosticsDebug.Assert(slot >= 0, "Expected positive slot.");
|
||||
|
||||
if (!isCollapsed)
|
||||
{
|
||||
|
@ -2272,7 +2274,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
// The underlying data was already added, therefore we need to avoid accessing any back-end data since we might be off by 1 row.
|
||||
_temporarilyResetCurrentCell = true;
|
||||
bool success = SetCurrentCellCore(-1, -1);
|
||||
Debug.Assert(success, "Expected successful SetCurrentCellCore call.");
|
||||
DiagnosticsDebug.Assert(success, "Expected successful SetCurrentCellCore call.");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2417,8 +2419,8 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
private void OnRemovingElement(int slotDeleted)
|
||||
{
|
||||
// Note that the row needs to be deleted no matter what. The underlying data row was already deleted.
|
||||
Debug.Assert(slotDeleted >= 0, "Expected positive slotDeleted.");
|
||||
Debug.Assert(slotDeleted < this.SlotCount, "Expected slotDeleted smaller than SlotCount.");
|
||||
DiagnosticsDebug.Assert(slotDeleted >= 0, "Expected positive slotDeleted.");
|
||||
DiagnosticsDebug.Assert(slotDeleted < this.SlotCount, "Expected slotDeleted smaller than SlotCount.");
|
||||
_temporarilyResetCurrentCell = false;
|
||||
|
||||
// Reset the current cell's address if it's on the deleted row, or after it.
|
||||
|
@ -2429,14 +2431,14 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
{
|
||||
// No editing is committed since the underlying entity was already deleted.
|
||||
bool success = SetCurrentCellCore(-1, -1, false /*commitEdit*/, false /*endRowEdit*/);
|
||||
Debug.Assert(success, "Expected successful SetCurrentCellCore call.");
|
||||
DiagnosticsDebug.Assert(success, "Expected successful SetCurrentCellCore call.");
|
||||
}
|
||||
else
|
||||
{
|
||||
// Underlying data of deleted row is gone. It cannot be accessed anymore. Skip the commit of the editing.
|
||||
_temporarilyResetCurrentCell = true;
|
||||
bool success = SetCurrentCellCore(-1, -1);
|
||||
Debug.Assert(success, "Expected successful SetCurrentCellCore call.");
|
||||
DiagnosticsDebug.Assert(success, "Expected successful SetCurrentCellCore call.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2631,8 +2633,8 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
|
||||
private void RemoveDisplayedElement(int slot, bool wasDeleted, bool updateSlotInformation)
|
||||
{
|
||||
Debug.Assert(slot >= this.DisplayData.FirstScrollingSlot, "Expected slot larger or equal to DisplayData.FirstScrollingSlot.");
|
||||
Debug.Assert(slot <= this.DisplayData.LastScrollingSlot, "Expected slot smaller or equal to DisplayData.LastScrollingSlot.");
|
||||
DiagnosticsDebug.Assert(slot >= this.DisplayData.FirstScrollingSlot, "Expected slot larger or equal to DisplayData.FirstScrollingSlot.");
|
||||
DiagnosticsDebug.Assert(slot <= this.DisplayData.LastScrollingSlot, "Expected slot smaller or equal to DisplayData.LastScrollingSlot.");
|
||||
|
||||
RemoveDisplayedElement(this.DisplayData.GetDisplayedElement(slot), slot, wasDeleted, updateSlotInformation);
|
||||
}
|
||||
|
@ -2686,7 +2688,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
{
|
||||
if (this.EditingRow != null && this.EditingRow.Cells != null)
|
||||
{
|
||||
Debug.Assert(this.EditingRow.Cells.Count == this.ColumnsItemsInternal.Count, "Expected EditingRow.Cells.Count equals ColumnsItemsInternal.Count.");
|
||||
DiagnosticsDebug.Assert(this.EditingRow.Cells.Count == this.ColumnsItemsInternal.Count, "Expected EditingRow.Cells.Count equals ColumnsItemsInternal.Count.");
|
||||
foreach (DataGridColumn column in this.Columns)
|
||||
{
|
||||
column.RemoveEditingElement();
|
||||
|
@ -2696,8 +2698,8 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
|
||||
private void RemoveElementAt(int slot, object item, bool isRow)
|
||||
{
|
||||
Debug.Assert(slot >= 0, "Expected positive slot.");
|
||||
Debug.Assert(slot < this.SlotCount, "Expected slot smaller than SlotCount.");
|
||||
DiagnosticsDebug.Assert(slot >= 0, "Expected positive slot.");
|
||||
DiagnosticsDebug.Assert(slot < this.SlotCount, "Expected slot smaller than SlotCount.");
|
||||
|
||||
OnRemovingElement(slot);
|
||||
|
||||
|
@ -2775,7 +2777,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
/// <returns>True when the slot is displayed.</returns>
|
||||
private bool SlotIsDisplayed(int slot)
|
||||
{
|
||||
Debug.Assert(slot >= 0, "Expected positive slot.");
|
||||
DiagnosticsDebug.Assert(slot >= 0, "Expected positive slot.");
|
||||
|
||||
if (slot >= this.DisplayData.FirstScrollingSlot &&
|
||||
slot <= this.DisplayData.LastScrollingSlot)
|
||||
|
@ -2804,8 +2806,8 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
// Updates display information and displayed rows after scrolling the given number of pixels
|
||||
private void ScrollSlotsByHeight(double height)
|
||||
{
|
||||
Debug.Assert(this.DisplayData.FirstScrollingSlot >= 0, "Expected positive DisplayData.FirstScrollingSlot.");
|
||||
Debug.Assert(!DoubleUtil.IsZero(height), "DoubleUtil.IsZero(height) is false.");
|
||||
DiagnosticsDebug.Assert(this.DisplayData.FirstScrollingSlot >= 0, "Expected positive DisplayData.FirstScrollingSlot.");
|
||||
DiagnosticsDebug.Assert(!DoubleUtil.IsZero(height), "DoubleUtil.IsZero(height) is false.");
|
||||
|
||||
_scrollingByHeight = true;
|
||||
try
|
||||
|
@ -2979,7 +2981,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
if (newFirstScrollingSlot < this.SlotCount - 1)
|
||||
{
|
||||
newFirstScrollingSlot = GetNextVisibleSlot(newFirstScrollingSlot);
|
||||
Debug.Assert(newFirstScrollingSlot != -1, "Expected newFirstScrollingSlot other than -1.");
|
||||
DiagnosticsDebug.Assert(newFirstScrollingSlot != -1, "Expected newFirstScrollingSlot other than -1.");
|
||||
}
|
||||
|
||||
this.NegVerticalOffset = 0;
|
||||
|
@ -3017,8 +3019,8 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
}
|
||||
}
|
||||
|
||||
Debug.Assert(this.DisplayData.FirstScrollingSlot >= 0, "Expected positive DisplayData.FirstScrollingSlot.");
|
||||
Debug.Assert(GetExactSlotElementHeight(this.DisplayData.FirstScrollingSlot) > this.NegVerticalOffset, "Expected GetExactSlotElementHeight(DisplayData.FirstScrollingSlot) larger than this.NegVerticalOffset.");
|
||||
DiagnosticsDebug.Assert(this.DisplayData.FirstScrollingSlot >= 0, "Expected positive DisplayData.FirstScrollingSlot.");
|
||||
DiagnosticsDebug.Assert(GetExactSlotElementHeight(this.DisplayData.FirstScrollingSlot) > this.NegVerticalOffset, "Expected GetExactSlotElementHeight(DisplayData.FirstScrollingSlot) larger than this.NegVerticalOffset.");
|
||||
|
||||
if (this.DisplayData.FirstScrollingSlot == 0)
|
||||
{
|
||||
|
@ -3036,7 +3038,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
VerticalOffset = newVerticalOffset;
|
||||
}
|
||||
|
||||
Debug.Assert(
|
||||
DiagnosticsDebug.Assert(
|
||||
_verticalOffset != 0 || this.NegVerticalOffset != 0 || this.DisplayData.FirstScrollingSlot <= 0,
|
||||
"Expected _verticalOffset other than 0 or this.NegVerticalOffset other than 0 or this.DisplayData.FirstScrollingSlot smaller than or equal to 0.");
|
||||
|
||||
|
@ -3044,8 +3046,8 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
|
||||
this.DisplayData.FullyRecycleElements();
|
||||
|
||||
Debug.Assert(DoubleUtil.GreaterThanOrClose(this.NegVerticalOffset, 0), "Expected NegVerticalOffset greater than or close to 0.");
|
||||
Debug.Assert(DoubleUtil.GreaterThanOrClose(_verticalOffset, this.NegVerticalOffset), "Expected _verticalOffset greater than or close to NegVerticalOffset.");
|
||||
DiagnosticsDebug.Assert(DoubleUtil.GreaterThanOrClose(this.NegVerticalOffset, 0), "Expected NegVerticalOffset greater than or close to 0.");
|
||||
DiagnosticsDebug.Assert(DoubleUtil.GreaterThanOrClose(_verticalOffset, this.NegVerticalOffset), "Expected _verticalOffset greater than or close to NegVerticalOffset.");
|
||||
|
||||
DataGridAutomationPeer peer = DataGridAutomationPeer.FromElement(this) as DataGridAutomationPeer;
|
||||
if (peer != null)
|
||||
|
@ -3061,7 +3063,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
|
||||
private void SelectDisplayedElement(int slot)
|
||||
{
|
||||
Debug.Assert(IsSlotVisible(slot), "Expected IsSlotVisible(slot) is true.");
|
||||
DiagnosticsDebug.Assert(IsSlotVisible(slot), "Expected IsSlotVisible(slot) is true.");
|
||||
FrameworkElement element = this.DisplayData.GetDisplayedElement(slot) as FrameworkElement;
|
||||
DataGridRow row = this.DisplayData.GetDisplayedElement(slot) as DataGridRow;
|
||||
if (row != null)
|
||||
|
@ -3192,9 +3194,9 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
|
||||
private void UnloadRow(DataGridRow dataGridRow)
|
||||
{
|
||||
Debug.Assert(dataGridRow != null, "Expected non-null dataGridRow.");
|
||||
Debug.Assert(_rowsPresenter != null, "Expected non-null _rowsPresenter.");
|
||||
Debug.Assert(_rowsPresenter.Children.Contains(dataGridRow), "Expected dataGridRow contained in _rowsPresenter.Children.");
|
||||
DiagnosticsDebug.Assert(dataGridRow != null, "Expected non-null dataGridRow.");
|
||||
DiagnosticsDebug.Assert(_rowsPresenter != null, "Expected non-null _rowsPresenter.");
|
||||
DiagnosticsDebug.Assert(_rowsPresenter.Children.Contains(dataGridRow), "Expected dataGridRow contained in _rowsPresenter.Children.");
|
||||
|
||||
if (_loadedRows.Contains(dataGridRow))
|
||||
{
|
||||
|
@ -3224,7 +3226,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
|
||||
private void UpdateDisplayedRows(int newFirstDisplayedSlot, double displayHeight)
|
||||
{
|
||||
Debug.Assert(!_collapsedSlotsTable.Contains(newFirstDisplayedSlot), "Expected newFirstDisplayedSlot not contained in _collapsedSlotsTable.");
|
||||
DiagnosticsDebug.Assert(!_collapsedSlotsTable.Contains(newFirstDisplayedSlot), "Expected newFirstDisplayedSlot not contained in _collapsedSlotsTable.");
|
||||
|
||||
int firstDisplayedScrollingSlot = newFirstDisplayedSlot;
|
||||
int lastDisplayedScrollingSlot = -1;
|
||||
|
@ -3282,18 +3284,18 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
if (visibleScrollingRows == 0)
|
||||
{
|
||||
firstDisplayedScrollingSlot = -1;
|
||||
Debug.Assert(lastDisplayedScrollingSlot == -1, "Expected lastDisplayedScrollingSlot equal to -1.");
|
||||
DiagnosticsDebug.Assert(lastDisplayedScrollingSlot == -1, "Expected lastDisplayedScrollingSlot equal to -1.");
|
||||
}
|
||||
|
||||
Debug.Assert(lastDisplayedScrollingSlot < this.SlotCount, "lastDisplayedScrollingRow larger than number of rows");
|
||||
DiagnosticsDebug.Assert(lastDisplayedScrollingSlot < this.SlotCount, "lastDisplayedScrollingRow larger than number of rows");
|
||||
|
||||
RemoveNonDisplayedRows(firstDisplayedScrollingSlot, lastDisplayedScrollingSlot);
|
||||
|
||||
Debug.Assert(this.DisplayData.NumDisplayedScrollingElements >= 0, "the number of visible scrolling rows can't be negative");
|
||||
Debug.Assert(this.DisplayData.NumTotallyDisplayedScrollingElements >= 0, "the number of totally visible scrolling rows can't be negative");
|
||||
Debug.Assert(this.DisplayData.FirstScrollingSlot < this.SlotCount, "firstDisplayedScrollingRow larger than number of rows");
|
||||
Debug.Assert(this.DisplayData.FirstScrollingSlot == firstDisplayedScrollingSlot, "Expected DisplayData.FirstScrollingSlot equal to firstDisplayedScrollingSlot.");
|
||||
Debug.Assert(this.DisplayData.LastScrollingSlot == lastDisplayedScrollingSlot, "DisplayData.LastScrollingSlot equal to lastDisplayedScrollingSlot.");
|
||||
DiagnosticsDebug.Assert(this.DisplayData.NumDisplayedScrollingElements >= 0, "the number of visible scrolling rows can't be negative");
|
||||
DiagnosticsDebug.Assert(this.DisplayData.NumTotallyDisplayedScrollingElements >= 0, "the number of totally visible scrolling rows can't be negative");
|
||||
DiagnosticsDebug.Assert(this.DisplayData.FirstScrollingSlot < this.SlotCount, "firstDisplayedScrollingRow larger than number of rows");
|
||||
DiagnosticsDebug.Assert(this.DisplayData.FirstScrollingSlot == firstDisplayedScrollingSlot, "Expected DisplayData.FirstScrollingSlot equal to firstDisplayedScrollingSlot.");
|
||||
DiagnosticsDebug.Assert(this.DisplayData.LastScrollingSlot == lastDisplayedScrollingSlot, "DisplayData.LastScrollingSlot equal to lastDisplayedScrollingSlot.");
|
||||
}
|
||||
|
||||
// Similar to UpdateDisplayedRows except that it starts with the LastDisplayedScrollingRow
|
||||
|
@ -3301,7 +3303,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
// when scrolling down to a full row
|
||||
private void UpdateDisplayedRowsFromBottom(int newLastDisplayedScrollingRow)
|
||||
{
|
||||
Debug.Assert(!_collapsedSlotsTable.Contains(newLastDisplayedScrollingRow), "Expected newLastDisplayedScrollingRow not contained in _collapsedSlotsTable.");
|
||||
DiagnosticsDebug.Assert(!_collapsedSlotsTable.Contains(newLastDisplayedScrollingRow), "Expected newLastDisplayedScrollingRow not contained in _collapsedSlotsTable.");
|
||||
|
||||
int lastDisplayedScrollingRow = newLastDisplayedScrollingRow;
|
||||
int firstDisplayedScrollingRow = -1;
|
||||
|
@ -3331,16 +3333,16 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
|
||||
this.DisplayData.NumTotallyDisplayedScrollingElements = deltaY > displayHeight ? visibleScrollingRows - 1 : visibleScrollingRows;
|
||||
|
||||
Debug.Assert(this.DisplayData.NumTotallyDisplayedScrollingElements >= 0, "Expected positive DisplayData.NumTotallyDisplayedScrollingElements.");
|
||||
Debug.Assert(lastDisplayedScrollingRow < this.SlotCount, "lastDisplayedScrollingRow larger than number of rows");
|
||||
DiagnosticsDebug.Assert(this.DisplayData.NumTotallyDisplayedScrollingElements >= 0, "Expected positive DisplayData.NumTotallyDisplayedScrollingElements.");
|
||||
DiagnosticsDebug.Assert(lastDisplayedScrollingRow < this.SlotCount, "lastDisplayedScrollingRow larger than number of rows");
|
||||
|
||||
this.NegVerticalOffset = Math.Max(0, deltaY - displayHeight);
|
||||
|
||||
RemoveNonDisplayedRows(firstDisplayedScrollingRow, lastDisplayedScrollingRow);
|
||||
|
||||
Debug.Assert(this.DisplayData.NumDisplayedScrollingElements >= 0, "the number of visible scrolling rows can't be negative");
|
||||
Debug.Assert(this.DisplayData.NumTotallyDisplayedScrollingElements >= 0, "the number of totally visible scrolling rows can't be negative");
|
||||
Debug.Assert(this.DisplayData.FirstScrollingSlot < this.SlotCount, "firstDisplayedScrollingRow larger than number of rows");
|
||||
DiagnosticsDebug.Assert(this.DisplayData.NumDisplayedScrollingElements >= 0, "the number of visible scrolling rows can't be negative");
|
||||
DiagnosticsDebug.Assert(this.DisplayData.NumTotallyDisplayedScrollingElements >= 0, "the number of totally visible scrolling rows can't be negative");
|
||||
DiagnosticsDebug.Assert(this.DisplayData.FirstScrollingSlot < this.SlotCount, "firstDisplayedScrollingRow larger than number of rows");
|
||||
}
|
||||
|
||||
private void UpdateRowDetailsHeightEstimate()
|
||||
|
@ -3425,7 +3427,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
endSlot--;
|
||||
}
|
||||
|
||||
Debug.Assert(endSlot >= 0, "Expected positive endSlot.");
|
||||
DiagnosticsDebug.Assert(endSlot >= 0, "Expected positive endSlot.");
|
||||
foreach (int slot in this.RowGroupHeadersTable.GetIndexes(targetRowGroupInfo.Slot + 1))
|
||||
{
|
||||
DataGridRowGroupInfo rowGroupInfo = this.RowGroupHeadersTable.GetValueAt(slot);
|
||||
|
@ -3451,7 +3453,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
int elementsToRemove = endDisplayedSlot - startDisplayedSlot + 1 - _collapsedSlotsTable.GetIndexCount(startDisplayedSlot, endDisplayedSlot);
|
||||
if (_focusedRow != null && _focusedRow.Slot >= startSlot && _focusedRow.Slot <= endSlot)
|
||||
{
|
||||
Debug.Assert(this.EditingRow == null, "Expected null EditingRow.");
|
||||
DiagnosticsDebug.Assert(this.EditingRow == null, "Expected null EditingRow.");
|
||||
|
||||
// Don't call ResetFocusedRow here because we're already cleaning it up below, and we don't want to FullyRecycle yet
|
||||
_focusedRow = null;
|
||||
|
@ -3486,7 +3488,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
{
|
||||
// Our first visible slot was collapsed, find the replacement
|
||||
int collapsedSlotsAbove = this.DisplayData.FirstScrollingSlot - startSlot - _collapsedSlotsTable.GetIndexCount(startSlot, this.DisplayData.FirstScrollingSlot);
|
||||
Debug.Assert(collapsedSlotsAbove > 0, "Expected positive collapsedSlotsAbove.");
|
||||
DiagnosticsDebug.Assert(collapsedSlotsAbove > 0, "Expected positive collapsedSlotsAbove.");
|
||||
int newFirstScrollingSlot = GetNextVisibleSlot(this.DisplayData.FirstScrollingSlot);
|
||||
while (collapsedSlotsAbove > 1 && newFirstScrollingSlot < this.SlotCount)
|
||||
{
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче