I'm trying to bind the system.io.WatcherChangeTypes
enum to the itemsource of a combobox, however the XAML editor can't seem to find the enum in the namespace. I'm guessing i'm overlooking something simpel but hopefully someone could help me out.
Samplecode:
<Window
x:Class="MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:EnumBindingTest"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
xmlns:sysIO="clr-namespace:System.IO;assembly=WindowsBase"
Title="MainWindow"
Width="200"
Height="100"
mc:Ignorable="d">
<Grid>
<!-- This Works -->
<ComboBox
Width="120"
HorizontalAlignment="Center"
VerticalAlignment="Top"
ItemsSource="{Binding Source={x:Static Fonts.SystemFontFamilies}}" />
<!-- This Doesn't Works -->
<ComboBox
Width="120"
HorizontalAlignment="Center"
VerticalAlignment="Bottom"
ItemsSource="{Binding Source={x:Static sysIO:WatcherChangeTypes}}" />
</Grid>
</Window>
I know the WatcherChangeTypes
is in the namespace System.IO, See: https://learn.microsoft.com/en-us/dotnet/api/system.io.watcherchangetypes?view=netframework-4.8