Static Members Not Supported ?
Posted: 02 Jul 2024, 00:02
Hi,
I'm trying to bind a field to a constant in code.
Here is my xaml:
And my C# code looks like this:
When I do this, I'm getting an error at runtime:
I'm confused about the error - is it saying the 'x:Static' part in my xaml is not allowed? Or is the problem that my class is static? The variable is a constant so I'm not sure if it's a mis-detection on that?
thanks,
sam
I'm trying to bind a field to a constant in code.
Here is my xaml:
Code: Select all
<MyUserControl MyBindingId="{x:Static local:Action.Id}">
Code: Select all
namespace Foo.Bar
{
public static class Action
{
public const int Id = 42;
}
}
Code: Select all
Static members not supported. Can't use 'Foo.Bar.Action.Interact'
thanks,
sam