我需要在我的 WPF 应用程序中使用 datepicker 控件,但我在 Toolbox 中找不到此控件。然后我安装了 WPFToolKit 并在 xaml 文件代码中添加了命名空间,但它仍然显示以下错误:
错误 1 XML 命名空间“http://schemas.microsoft.com/winfx/2006/xaml/presentation”中不存在标记“DatePicker” . 第 23 行位置 18。F:\Muhammad Anees\codereason_reports_v0.5_alpha\Samples\SimpleReport\EmployeeManager.xaml 23 18 Employee_Manager
这是我的 xaml 文件代码:
<Window x:Class="SimpleReport.EmployeeManager"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:toolkit="clr-namespace:Microsoft.Windows.Controls;assembly=WPFToolkit"
Title="Employee Manager - Islam Engineering Pvt Ltd." Height="513" Width="865" ResizeMode="CanMinimize">
<TabControl Height="482" HorizontalAlignment="Left" Margin="0,-2,0,0" Name="tabControl1" VerticalAlignment="Top" Width="832">
<TabItem Header="Add New Employee" Name="tabItem1">
<Grid Width="806" Height="440">
<TextBox Height="23" HorizontalAlignment="Left" Margin="177,14,0,0" Name="txtBarcode" VerticalAlignment="Top" Width="120" Background="#FFE0DECC" KeyUp="txtBarcode_KeyUp" />
<Label Content="Employee ID:" Height="28" HorizontalAlignment="Left" Margin="19,14,0,0" Name="label1" VerticalAlignment="Top" Width="85" />
<TextBox Height="23" HorizontalAlignment="Left" Margin="177,49,0,0" Name="emp_name" VerticalAlignment="Top" Width="254" IsEnabled="True" />
<Label Content="Employee Name:" Height="28" Margin="19,0,676,365" Name="label2" VerticalAlignment="Bottom" />
<Button Content="Add" Height="23" Name="addbtn" Width="75" Background="#FFD0B8B8" BorderBrush="#FFB19414" Margin="176,136,554,281" Click="addbtn_Click" />
<Label Height="28" HorizontalAlignment="Left" Margin="177,78,0,0" Name="addmsg" VerticalAlignment="Top" Width="275" Content="Employee added Successfully!" />
</Grid>
</TabItem>
<TabItem Header="Employee Attendance Report" Name="tabItem2">
<Grid>
<Label Content="Select Report Type:" Height="28" HorizontalAlignment="Left" Margin="24,26,0,0" Name="label7" VerticalAlignment="Top" Width="122" />
<Button Background="#FFD0B8B8" BorderBrush="#FFB19414" Content="Generate Report" Height="23" Margin="152,157,557,270" Name="reportBtn" Click="button1_Click" />
<RadioButton Content="Today's Report" Height="16" HorizontalAlignment="Left" Margin="152,31,0,0" Name="radioButton1" VerticalAlignment="Top" />
<DatePicker Height="25" HorizontalAlignment="Left" Margin="42,26,0,0" Name="datePicker1" VerticalAlignment="Top" Width="115" />
<RadioButton Content="Previous Date" Height="16" HorizontalAlignment="Left" Margin="152,62,0,0" Name="radioButton2" VerticalAlignment="Top" />
<RadioButton Content="Within Range" Height="16" HorizontalAlignment="Left" Margin="152,95,0,0" Name="radioButton3" VerticalAlignment="Top" />
</Grid>
</TabItem>
<TabItem Header="Remove Employee Record" Name="tabItem3">
<Grid>
<ComboBox Height="23" HorizontalAlignment="Left" Margin="181,26,0,0" Name="comboBox3" VerticalAlignment="Top" Width="120" SelectionChanged="comboBox3_SelectionChanged" SelectedIndex="0" />
<Label Content="Select Employee ID:" Height="28" HorizontalAlignment="Left" Margin="29,26,0,0" Name="label5" VerticalAlignment="Top" Width="122" />
<Button Background="#FFD0B8B8" BorderBrush="#FFB19414" Content="Remove" Height="23" Margin="181,80,566,347" Name="button2" Width="75" />
</Grid>
</TabItem>
</TabControl>
DatePicker 控件位于上述代码中的第二个 Radiobutton 控件之后。请告诉我如何克服这个问题。谢谢