This is my XAML:
ItemsSource="{x:Static app:HealthCheckSystemCategoryLookup.All}
Is there a way to make HealthCheckSystemCategoryLookup.All a function instead of a property?
This is my XAML:
ItemsSource="{x:Static app:HealthCheckSystemCategoryLookup.All}
Is there a way to make HealthCheckSystemCategoryLookup.All a function instead of a property?
No, x:Static
can only handle enum members, properties, and fields. You can use ObjectDataProvider
if you want to bind to the result of a method call. You would do something like this:
<Window.Resources>
<ObjectDataProvider
x:Key="Data"
ObjectType="app:HealthCheckSystemCategoryLookup"
MethodName="All"/>
</Window.Resources>
<ListBox ItemsSource="{Binding Source={StaticResource Data}}" />
Why not just bind to a property which calls the method in its Getter.
public IEnumberable<object> Data
{
get
{
return All();
}
}