As you can see in the documentation here https://video2.skills-academy.com/en-us/uwp/api/windows.ui.xaml.uielement.actualoffset, UIElement.ActualOffset was added with 10.0.18362.0 (1903). If you use TargetPlatformVersion is greater or equals to 10.0.18362.0, you are allowed to use in your code UIElement.ActualOffset and there are no compilation errors, but if your TargetPlatformMinVersion is smaller than 10.0.18362.0, than you have to add to your code extra checks before to use to use it.
Use ApiInformation method to detect whether a specified member, type, or API contract is present, for example:
try
{
UIElement polyline1 = canvas.Children.FirstOrDefault(x => x.GetType().Name == typeof(Polyline).Name);
Debug.Write($"fullname: {polyline1.GetType().FullName}");
Debug.Write($"is polyline: {polyline1 is Polyline}");
Debug.Write($"as polyline: {polyline1 as Polyline}");
bool isPropertyPresent = ApiInformation.IsPropertyPresent("Windows.UI.Xaml.UIElement", "ActualOffset");
double actualOffsetX = isPropertyPresent
? polyline1.ActualOffset.X
: polyline1.TransformToVisual(canvas).TransformPoint(new Point(0, 0)).X;
}
catch (Exception ex)
{
Debug.Write($"error: {ex}");
}
The example above is just to show how you can use ApiInformation, in your particular case I think the best option is to use only
polyline1.TransformToVisual(canvas).TransformPoint(new Point(0, 0)).X;