Skip to content

Commit b495d20

Browse files
authored
Merge pull request #8707 from unoplatform/dev/jela/net6-elevatedview
fix(net6): Restore ElevatedView templated parent support
2 parents e92fbde + 5a782ff commit b495d20

File tree

3 files changed

+11
-20
lines changed

3 files changed

+11
-20
lines changed

src/SamplesApp/SamplesApp.net6mobile/SamplesApp.net6mobile.csproj

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
<AssemblyName>SamplesApp</AssemblyName>
99
<DefineConstants>$(DefineConstants);XAMARIN;HAS_UNO</DefineConstants>
1010
<IsUnoHead>true</IsUnoHead>
11-
12-
<PublishTrimmed>false</PublishTrimmed>
1311

1412
<RuntimeIdentifier Condition="'$(TargetFramework)' == 'net6.0-ios'">iossimulator-x64</RuntimeIdentifier>
1513
<RuntimeIdentifier Condition="'$(TargetFramework)' == 'net6.0-maccatalyst'">maccatalyst-x64</RuntimeIdentifier>
@@ -35,13 +33,6 @@
3533

3634
<PropertyGroup Condition="'$(TargetFramework)'=='net6.0-ios'">
3735
<SupportedOSPlatformVersion>10.0</SupportedOSPlatformVersion>
38-
39-
<!--
40-
Workaround for
41-
tools\msbuild\iOS\Xamarin.iOS.Common.After.targets(368,3): error MSB3371: The file "obj\Release\net6.0-ios\iossimulator-x64\linked\Link.semaphore"
42-
cannot be created. Could not find a part of the path 'C:\a\1\s\src\SamplesApp\SamplesApp.net6mobile\obj\Release\net6.0-ios\iossimulator-x64\linked\Link.semaphore'.
43-
-->
44-
<PublishTrimmed>false</PublishTrimmed>
4536
</PropertyGroup>
4637

4738
<PropertyGroup Condition="'$(TargetFramework)'=='net6.0-android'">

src/Uno.UI.Toolkit/ElevatedView.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ namespace Uno.UI.Toolkit
2020
[TemplatePart(Name = "PART_Border", Type = typeof(Border))]
2121
[TemplatePart(Name = "PART_ShadowHost", Type = typeof(Grid))]
2222
public sealed partial class ElevatedView : Control
23-
#if !NETFX_CORE && !NETCOREAPP
23+
#if HAS_UNO
2424
, ICustomClippingElement
2525
#endif
2626
{
@@ -59,7 +59,7 @@ public ElevatedView()
5959
{
6060
DefaultStyleKey = typeof(ElevatedView);
6161

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

6565
// Patch to deactivate the clipping by ContentControl
@@ -114,7 +114,7 @@ public object ElevatedContent
114114
set => SetValue(ElevatedContentProperty, value);
115115
}
116116

117-
#if !NETFX_CORE && !NETCOREAPP
117+
#if HAS_UNO
118118
public new static DependencyProperty BackgroundProperty { get ; } = DependencyProperty.Register(
119119
"Background",
120120
typeof(Brush),
@@ -178,7 +178,7 @@ private void UpdateElevation()
178178
return; // not initialized yet
179179
}
180180

181-
#if !NETFX_CORE && !NETCOREAPP
181+
#if HAS_UNO
182182
SynchronizeContentTemplatedParent();
183183
#endif
184184

@@ -199,13 +199,13 @@ private void UpdateElevation()
199199
_border.SetElevationInternal(Elevation, ShadowColor);
200200
#elif __SKIA__
201201
this.SetElevationInternal(Elevation, ShadowColor);
202-
#elif NETFX_CORE || NETCOREAPP
202+
#elif (NETFX_CORE || NETCOREAPP) && !HAS_UNO
203203
_border.SetElevationInternal(Elevation, ShadowColor, _shadowHost as DependencyObject, CornerRadius);
204204
#endif
205205
}
206206
}
207207

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

211211
bool ICustomClippingElement.ForceClippingToLayoutSlot => false;

src/Uno.UI.Toolkit/UIElementExtensions.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
using Uno.Foundation.Logging;
1616
#endif
1717

18-
#if NETCOREAPP
18+
#if NETCOREAPP && !HAS_UNO
1919
using Microsoft.UI;
2020
#endif
2121

@@ -75,7 +75,7 @@ private static void OnElevationChanged(DependencyObject dependencyObject,
7575

7676
#if __IOS__ || __MACOS__
7777
internal static void SetElevationInternal(this DependencyObject element, double elevation, Color shadowColor, CGPath path = null)
78-
#elif NETFX_CORE || NETCOREAPP
78+
#elif (NETFX_CORE || NETCOREAPP) && !HAS_UNO
7979
internal static void SetElevationInternal(this DependencyObject element, double elevation, Color shadowColor, DependencyObject host = null, CornerRadius cornerRadius = default(CornerRadius))
8080
#else
8181
internal static void SetElevationInternal(this DependencyObject element, double elevation, Color shadowColor)
@@ -163,7 +163,7 @@ internal static void SetElevationInternal(this DependencyObject element, double
163163
var shadow = new ShadowState(dx, dy, sigmaX, sigmaY, shadowColor);
164164
visual.ShadowState = shadow;
165165
}
166-
#elif NETFX_CORE || NETCOREAPP
166+
#elif (NETFX_CORE || NETCOREAPP) && !HAS_UNO
167167
if (element is UIElement uiElement)
168168
{
169169
var compositor = ElementCompositionPreview.GetElementVisual(uiElement).Compositor;
@@ -236,7 +236,7 @@ internal static void SetElevationInternal(this DependencyObject element, double
236236
#endif
237237
}
238238

239-
#endregion
239+
#endregion
240240

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

0 commit comments

Comments
 (0)