Skip to content

Commit

Permalink
fix(net6): Restore ElevatedView templated parent support
Browse files Browse the repository at this point in the history
  • Loading branch information
jeromelaban committed May 6, 2022
1 parent 5bcc2b4 commit 5a782ff
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
12 changes: 6 additions & 6 deletions src/Uno.UI.Toolkit/ElevatedView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ namespace Uno.UI.Toolkit
[TemplatePart(Name = "PART_Border", Type = typeof(Border))]
[TemplatePart(Name = "PART_ShadowHost", Type = typeof(Grid))]
public sealed partial class ElevatedView : Control
#if !NETFX_CORE && !NETCOREAPP
#if HAS_UNO
, ICustomClippingElement
#endif
{
Expand Down Expand Up @@ -59,7 +59,7 @@ public ElevatedView()
{
DefaultStyleKey = typeof(ElevatedView);

#if !NETFX_CORE && !NETCOREAPP
#if HAS_UNO
Loaded += (snd, evt) => SynchronizeContentTemplatedParent();

// Patch to deactivate the clipping by ContentControl
Expand Down Expand Up @@ -114,7 +114,7 @@ public object ElevatedContent
set => SetValue(ElevatedContentProperty, value);
}

#if !NETFX_CORE && !NETCOREAPP
#if HAS_UNO
public new static DependencyProperty BackgroundProperty { get ; } = DependencyProperty.Register(
"Background",
typeof(Brush),
Expand Down Expand Up @@ -178,7 +178,7 @@ private void UpdateElevation()
return; // not initialized yet
}

#if !NETFX_CORE && !NETCOREAPP
#if HAS_UNO
SynchronizeContentTemplatedParent();
#endif

Expand All @@ -199,13 +199,13 @@ private void UpdateElevation()
_border.SetElevationInternal(Elevation, ShadowColor);
#elif __SKIA__
this.SetElevationInternal(Elevation, ShadowColor);
#elif NETFX_CORE || NETCOREAPP
#elif (NETFX_CORE || NETCOREAPP) && !HAS_UNO
_border.SetElevationInternal(Elevation, ShadowColor, _shadowHost as DependencyObject, CornerRadius);
#endif
}
}

#if !NETFX_CORE && !NETCOREAPP
#if HAS_UNO
bool ICustomClippingElement.AllowClippingToLayoutSlot => false; // Never clip, since it will remove the shadow

bool ICustomClippingElement.ForceClippingToLayoutSlot => false;
Expand Down
10 changes: 5 additions & 5 deletions src/Uno.UI.Toolkit/UIElementExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
using Uno.Foundation.Logging;
#endif

#if NETCOREAPP
#if NETCOREAPP && !HAS_UNO
using Microsoft.UI;
#endif

Expand Down Expand Up @@ -75,7 +75,7 @@ private static void OnElevationChanged(DependencyObject dependencyObject,

#if __IOS__ || __MACOS__
internal static void SetElevationInternal(this DependencyObject element, double elevation, Color shadowColor, CGPath path = null)
#elif NETFX_CORE || NETCOREAPP
#elif (NETFX_CORE || NETCOREAPP) && !HAS_UNO
internal static void SetElevationInternal(this DependencyObject element, double elevation, Color shadowColor, DependencyObject host = null, CornerRadius cornerRadius = default(CornerRadius))
#else
internal static void SetElevationInternal(this DependencyObject element, double elevation, Color shadowColor)
Expand Down Expand Up @@ -163,7 +163,7 @@ internal static void SetElevationInternal(this DependencyObject element, double
var shadow = new ShadowState(dx, dy, sigmaX, sigmaY, shadowColor);
visual.ShadowState = shadow;
}
#elif NETFX_CORE || NETCOREAPP
#elif (NETFX_CORE || NETCOREAPP) && !HAS_UNO
if (element is UIElement uiElement)
{
var compositor = ElementCompositionPreview.GetElementVisual(uiElement).Compositor;
Expand Down Expand Up @@ -236,7 +236,7 @@ internal static void SetElevationInternal(this DependencyObject element, double
#endif
}

#endregion
#endregion

internal static Thickness GetPadding(this UIElement uiElement)
{
Expand Down Expand Up @@ -354,7 +354,7 @@ internal static DependencyProperty FindDependencyPropertyUsingReflection<TProper
uiElement.Log().Warn($"The {propertyName} dependency property does not exist on {type}");
#endif
}
#if !NETFX_CORE && !NETCOREAPP
#if HAS_UNO
else if (property.Type != propertyType)
{
uiElement.Log().Warn($"The {propertyName} dependency property {type} is not of the {propertyType} Type.");
Expand Down

0 comments on commit 5a782ff

Please sign in to comment.