0

制作一个 WPF UI,有一个网格,一些行和文本块。这是 XAMl 的 CS;

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Xaml;
using Microsoft;
using Microsoft.Expression;
using Microsoft.Expression.Utility.ValueEditors;
using IGotThis;

namespace Project1
{
    /// <summary>
    /// Interaction logic for UserControl1.xaml
    /// </summary>
    public partial class UserControl1 : UserControl
    {
        public UserControl1()
        {
            InitializeComponent();
        }
        void Page_Loaded(object sender, RoutedEventArgs e)
        {
            String[,] outlookArray = IGotThis.PullOutLookMessages.getOutlookMessages();
            this.OutLookInfo.DataContext = outlookArray;
        }
    }

IGotThis 是另一个 CS,我认为它是无关的。每当我调试程序时,我的 WPF 设计器页面都会被替换为:

例外:组件“Microsoft.Expression.Utility.ValueEditors.SplitComboBox”没有由 URI“/Microsoft.Expression.Utility;component/valueeditors/splitcombobox.xaml”标识的资源。

堆栈跟踪

在 System.Windows.Application.LoadComponent(对象组件,Uri resourceLocator) InnerException:无。

我一点也不理解这个错误。在我的 xaml 代码中, UserControl带有相同错误的蓝色蠕虫下划线。

编辑:继承我的 XAML

<UserControl x:Class="Project1.UserControl1"
         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
         xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
         xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
         mc:Ignorable="d" Width="528" Height="556.4">
<Grid x:Name="OutLookInfo">
    <Grid.ColumnDefinitions>
        <ColumnDefinition Width="Auto" MinWidth="98"></ColumnDefinition>
        <ColumnDefinition></ColumnDefinition>
    </Grid.ColumnDefinitions>
    <Grid.RowDefinitions>
        <RowDefinition Height="69*"></RowDefinition>
        <RowDefinition Height="139*"></RowDefinition>
        <RowDefinition Height="93*"></RowDefinition>
        <RowDefinition Height="255*"></RowDefinition>
    </Grid.RowDefinitions>
    <TextBlock Text="Sender Name"  HorizontalAlignment="Left" Height="22" Margin="0,23,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="98" FontSize="16" TextAlignment="Center"/>
    <TextBlock Text="CC'd People"  HorizontalAlignment="Left" Height="22" Margin="0,59,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="98" FontSize="16" TextAlignment="Center" Grid.Row="1"/>
    <TextBlock Text="Subject"  HorizontalAlignment="Left" Height="22" Margin="0,39,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="98" FontSize="16" TextAlignment="Center" Grid.Row="2"/>
    <TextBlock Text="Body Text"  HorizontalAlignment="Left" Height="22" Margin="0,112,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="98" FontSize="16" TextAlignment="Center" Grid.Row="3"/>
    <TextBlock Text ="{Binding outlookArray}" Grid.Column="1" HorizontalAlignment="Left" Height="235" Margin="10,10,0,0" Grid.Row="3" TextWrapping="Wrap" VerticalAlignment="Top" Width="410"/>
    <TextBlock Grid.Column="1" HorizontalAlignment="Left" Height="71" Margin="10,10,0,0" Grid.Row="2" TextWrapping="Wrap" VerticalAlignment="Top" Width="410" FontSize="18"/>
    <TextBlock Grid.Column="1" HorizontalAlignment="Left" Height="119" Margin="10,10,0,0" Grid.Row="1" TextWrapping="Wrap" VerticalAlignment="Top" Width="410" FontSize="18"/>
    <TextBlock Grid.Column="1" HorizontalAlignment="Left" Height="49" Margin="10,10,0,0" TextWrapping="Wrap"  VerticalAlignment="Top" Width="410" FontSize="18"/>
</Grid>

我不确定这是否相关,但我刚刚在我的错误列表中发现了这个警告:

Warning 1   There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "Microsoft.Expression.Utility, Version=5.0.30709.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=x86", "x86". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project.  IGotThis

我不确定这意味着什么,或者如何更改“目标处理器架构”

4

1 回答 1

0

修复。我认为这可能与我试图在控制台应用程序中运行 WPF 有关。我切换了,现在没有任何错误。

于 2013-07-22T15:14:22.497 回答