我收到一个编译错误
错误 1 找不到类型或命名空间名称“转换器”(您是否缺少 using 指令或程序集引用?) G:\C#\Practice\DataGrid\DataGrid\obj\x86\Debug\MainWindow.g.cs 12 7 数据网格
下面是我的 Xaml 代码,我是 WPF 新手,请帮帮我。我有转换器类。
<Window x:Class="DataGrid.MainWindow "
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Height="500" Width="700"
xmlns:c="clr-namespace:Converters">
<Window.Resources>
<c:BoolToStringConverter x:Key="BoolToStringConverter" />
</Window.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="59*" />
<RowDefinition Height="402*" />
</Grid.RowDefinitions>
<StackPanel Margin="0,55,0,0" Grid.RowSpan="2">
<DataGrid ItemsSource="{Binding Path=Courses}" AutoGenerateColumns="False" HorizontalAlignment="Left" Name="datagrid1" CanUserAddRows="False" HeadersVisibility="Column" RowDetailsVisibilityMode="Visible" VerticalScrollBarVisibility="Auto" CanUserSortColumns="True" CanUserResizeColumns="False" Height="339" Width="610">
<DataGrid.Resources>
<Style TargetType="{x:Type CheckBox}" x:Key="DataGridCheckBox">
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="HorizontalContentAlignment" Value="Center" />
<Setter Property="IsEnabled" Value="True" />
<Setter Property="Margin" Value="4" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="VerticalContentAlignment" Value="Center" />
</Style>
</DataGrid.Resources>
<DataGrid.Columns>
<DataGridTemplateColumn Header="Course Title" Width="100">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<StackPanel>
<TextBlock Text="{Binding Path=Code}" VerticalAlignment="Center" />
</StackPanel>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="Course Description" Width="*">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<StackPanel>
<TextBlock Text="{Binding Path=Descrption}" VerticalAlignment="Center" />
</StackPanel>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="Required" Width="100">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Path=IsRequired, Converter={StaticResource BoolToStringConverter}}"
VerticalAlignment="Center" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
</StackPanel>
<StackPanel Margin="0,0,539,32">
<TextBlock Text="Select Enroolment:" FontSize="15"
Height="26"
Grid.RowSpan="1"
Width="134">
</TextBlock>
</StackPanel>
<TextBlock DockPanel.Dock="Left"
HorizontalAlignment="Left"
Text="Select Course:"
Width="139" FontSize="15"
Margin="0,32,0,0">
</TextBlock>
<ComboBox HorizontalAlignment="Right"
Margin="0,0,69,33"
Name="comboBox1"
Width="476"
Height="23"
VerticalAlignment="Bottom" />
</Grid>