我的解决方案中有一个 C# 类库项目,我在其中添加了一个用户控件并粘贴了我的 WPF 应用程序中的以下代码。
xaml 看起来一切都很好,但我在编译时遇到了某些错误。例如:
1) System.Windows.DataFormats' does not contain a definition for 'StringFormat'
2) System.Windows.Controls.TextBlock' does not contain a definition for 'Background' and no extension method 'Background' accepting a first argument of type 'System.Windows.Controls.TextBlock' could be found
3) System.Windows.Media.Colors' does not contain a definition for 'LightCoral'
4) System.Windows.Controls.TextBlock' does not contain a definition for 'Background' and no extension method 'Background' accepting a first argument of type 'System.Windows.Controls.TextBlock' could be found (are you missing a using directive or an assembly reference?)
我不确定为什么会出现这些错误,这些错误与 TextBox 的背景、拖放、数据格式等有关。.xaml.cs代码也在这里。http://pastebin.com/CY8E8prz