Noesis.Vector2 property naming doesn't match System.Windows.Vector
In System.Windows.Vector, the X and Y properties are defined as capitals ("X" and "Y"). But in the Noesis implementation of Vector2, the properties are defined as lowercase ("x" and "y"). Using the System.Windows.Vector in the XAML ends up throwing errors that there is no binding for the X property.
For example:
and in the Xaml:
Will throw the following errors:
I was curious if there was a specific reason the properties are different in their capitalization?
Are there any issues I'm unaware of in implementing this change?
Is there a better way to represent Vector2 (or Vector3) data that I'm not aware of?
Using System.Numerics.Vector2 has no properties defined in the C# side, so Blend doesn't like it.
For example:
Code: Select all
using System.Windows;
public class ControllerVisualizationContext
{
...
public ControllerInput ControllerInput { get; set; }
}
public class ControllerInput
{
...
// Ranged -1 to 1. Inactive = 0
public Vector LStick { get; set; }
...
}
Code: Select all
<TextBlock x:Name="PreciseValue_L_Analog" Text="{Binding ControllerInput.LStick.X, StringFormat=\{0:F2\}}" />I can eliminate this if I modify the Vector2 reflection to add the capital accessors:Can't solve PropertyPath: Type 'Vector2' does not contain a property named 'X'
Binding failed: Path=ControllerInput.LStick.X, Source=Noesis.ControllerVisualizationContext.f1de4b00(''), Target=TextBlock('PreciseValue_L_Analog'), TargetProperty=TextBlock.Text
Code: Select all
NS_IMPLEMENT_INLINE_REFLECTION(Vector2, NoParent)
{
NsProp("x", &Vector2::x);
NsProp("y", &Vector2::y);
NsProp("X", &Vector2::x); // added
NsProp("Y", &Vector2::y); // added
}
Are there any issues I'm unaware of in implementing this change?
Is there a better way to represent Vector2 (or Vector3) data that I'm not aware of?
Using System.Numerics.Vector2 has no properties defined in the C# side, so Blend doesn't like it.
Re: Noesis.Vector2 property naming doesn't match System.Windows.Vector
Your patch is safe. For historical reasons our math library is using lower case for properties. We have plans to improve this by hiding our math types for internal use (SIMD friendly, no reflection) and create new types in Drawing that will mimic WPF ones (there are already a few like Point, Rect, Color, Thickness...).
Please, feel free to file a ticket if you want to track this.
Please, feel free to file a ticket if you want to track this.
Who is online
Users browsing this forum: No registered users and 6 guests