I am trying to bind to a GridLength instance in a Windows Store app (compiled with the Visual Studio 2013 compiler) in C++/CX, but for some reason I keep getting the following error at runtime:
Error: Converter failed to convert value of type 'Windows.Foundation.IReference`1<Windows.UI.Xaml.GridLength>' to type 'GridLength'; BindingExpression: Path='MyHeight' DataItem='MyNamespace.MyObject'; target element is 'Windows.UI.Xaml.Controls.RowDefinition' (Name='null'); target property is 'Height' (type 'GridLength').
My code essentially looks like:
namespace MyNamespace
{
[Windows::UI::Xaml::Data::Bindable]
public ref class MyObject sealed
{
property Windows::UI::Xaml::GridLength MyHeight
{
Windows::UI::Xaml::GridLength get() { return myHeight; }
}
}
}
and my XAML file essentially looks like:
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="{Binding MyHeight}"/>
</Grid.RowDefinitions>
</Grid>
Just FYI, other properties in my class are binding properly. The issue appears to only be with the GridLength value struct. It is obviously finding the property correctly, but for some reason it can't match up the types.