I'm looking for a way to set the bitwise (flag) enum values in UWP XAML. The WPF approach (comma separated, "value1,value2,value3") does not seem to work.
Any pointers are greatly appreciated!
edit 1
It appears comma separated syntax is correct. The issue I'm having has something specifically to do with the particular enum. I'm trying to expose CoreInputDeviceTypes on the InkCanvas class with the following property:
public CoreInputDeviceTypes InputDeviceTypes
{
get { return (CoreInputDeviceTypes)GetValue(InputDeviceTypesProperty); }
set { SetValue(InputDeviceTypesProperty, value); }
}
// Using a DependencyProperty as the backing store for InputDeviceTypes. This enables animation, styling, binding, etc...
public static readonly DependencyProperty InputDeviceTypesProperty =
DependencyProperty.Register("InputDeviceTypes", typeof(CoreInputDeviceTypes), typeof(CustomInkCanvas), new PropertyMetadata(CoreInputDeviceTypes.Touch, new PropertyChangedCallback(OnInputDeviceChanged)));
private static void OnInputDeviceChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
(d as CustomInkCanvas).InkPresenter.InputDeviceTypes = (CoreInputDeviceTypes)e.NewValue;
}
With XAML side of things being:
<local:CustomInkCanvas Width="2000" Height="2000" x:Name="inkCanvas" InputDeviceTypes="Mouse,Pen">
</local:CustomInkCanvas>
That fails with the follwoing exception:
Failed to assign to property 'App5.CustomInkCanvas.InputDeviceTypes'. [Line: 14 Position: 101]'