I have a Visual Studio 2019 UWP project with a XAML page using dependency properties for binding values. It's all working fine in debug mode but not in release. What's wrong with the way I am binding that VS relase doesn't like?
The sample code below shows a Windows.UI.Xaml.Controls.FontIcon with a binding to MyDependencyClass DependencyObject class.
<FontIcon FontFamily="{ThemeResource SymbolThemeFontFamily}" Glyph="{Binding ElementName=MyPageUI, Path=(local:myDependencyClass.myGlyph)}" />
The error is Windows.UI.Xaml.Markup.XamlParseException: 'XAML parsing failed.', and it is due to this binding in the FontIcon element. It does not matter the type of control, same error.
{Binding ElementName=MyPageUI, Path=(local:myDependencyClass.myGlyph)}
public abstract class MyDependencyClass : DependencyObject
{
public static readonly DependencyProperty MyGlyphProperty;
public static void SetMyGlyph(DependencyObject DepObject, string value)
{
DepObject.SetValue(MyGlyphProperty, value);
}
public static string GetMyGlyph(DependencyObject DepObject)
{
return (string)DepObject.GetValue(MyGlyphProperty);
}
static MyDependencyClass()
{
PropertyMetadata MyPropertyMetadata = new PropertyMetadata("\xE72E");
MyGlyphProperty = DependencyProperty.RegisterAttached("MyGlyph",
typeof(string),
typeof(MyDependencyClass),
MyPropertyMetadata);
}