I'm converting C# WPF component to UWP and it contains classes with float type properties.
When trying to set value in xaml, Visual Studio xaml editor complains: "Unable to cast object of type 'System.Double' to type 'System.Single'. When running: can't convert to Windows.Foundation.Single.
Doubles work fine.
UWP ScrollViewer has e.g. MinZoomFactor property, which is float and it produces no problems.
Also UIElement has Rotation property, which is float.
So one would guess that float should be possible, but how, if at all?
Read some documentation, which indicates that float is not supported, which is a bit strange as per ScrollViewer and UIElement.
https://docs.microsoft.com/en-us/windows/uwp/cpp-and-winrt-apis/xaml-cust-ctrl
This is from test project how float property is defined.
public static DependencyProperty ValueProperty =
DependencyProperty.Register(
"Value",
typeof(float),
typeof(FloatContainer),
new PropertyMetadata(0.0f, new PropertyChangedCallback(ValueChanged)));
public float Value
{
get { return (float)GetValue(ValueProperty); }
set { SetValue(ValueProperty, value); }
}