类型引用找不到名为的公共类型

时间:2019-06-27 07:10:38

标签: c# wpf forms .net-4.6.1

我收到有关“类型引用找不到名为...的公共类型”的错误,我在2个xaml文件中有错误。 1与ComboboxiTem。另一个在datagridColumnHeader中。 至于comboboxitem->这些项目来自一个列表,并在“ onLoaded”事件触发器上加载。由于某种原因,代码可以正常工作,但是当我尝试编辑甚至打开文件并再次生成文件时,都会出现此错误。

无论我在哪里搜索或做什么,它似乎都无法解决这个问题:(。当我覆盖文件时,它确实可以再次工作并可以生成。但是即使打开它,我也注定了。 有谁知道如何解决此问题,或者为什么我会收到此错误。

ps:作为旁注。这不是在Visual Studio中创建的,而是在cms系统中的自定义IDE构建中创建的,它具有自己的intellisense和用.net 4.6.1编写的编译器,并使用Windows控件和/或telerik控件

''' Datagridcolumnheader错误

<!--saved by ADM on BEPP15366 with appConfig.exe v4.5.2.0 on 27/06/2019 08:15:18-->
<app:Synoptic x:Class="appClient_gen.Psim_ResponsiblesEditor"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:app="http://prysm.fr/AppVision"
xmlns:video="http://prysm.fr/AppVideo"
xmlns:gen="clr-namespace:appClient_gen" InitialWidth="1280" InitialHeight="900" Format="2.0" AppVersion="4.5.2.0" Date="2019-06-27 08:15:18Z">
  <app:SynoItem.AnimationItems>
    <app:ActionAnim x:Key="script">
      <app:CData xml:space="preserve"><![CDATA[private System.Collections.ObjectModel.ObservableCollection<Responsible> responsibles;
private System.Collections.ObjectModel.ObservableCollection<Parameter> parameters;

public override void OnLoaded() 
{ 
responsibles = Responsible.GetResponsibles();
dataGrid.ItemsSource = responsibles;
dataGrid.Columns[0].Width=(new System.Windows.Controls.DataGridLength(0.05, System.Windows.Controls.DataGridLengthUnitType.Star));
dataGrid.Columns[1].Width=(new System.Windows.Controls.DataGridLength(0.35, System.Windows.Controls.DataGridLengthUnitType.Star));
dataGrid.Columns[2].Width=(new System.Windows.Controls.DataGridLength(0.35, System.Windows.Controls.DataGridLengthUnitType.Star));
dataGrid.Columns[3].Width=(new System.Windows.Controls.DataGridLength(0.25, System.Windows.Controls.DataGridLengthUnitType.Star));
dataGrid.CanUserDeleteRows = false;
dataGrid.CanUserAddRows = false;
//dataGrid.Controls[0].BackColor = Color.Gray;
parameters = Parameter.GetParameters();
dataGrid2.ItemsSource = parameters;
dataGrid2.Columns[0].Width=(new System.Windows.Controls.DataGridLength(1.0, System.Windows.Controls.DataGridLengthUnitType.Star));
dataGrid2.CanUserDeleteRows = false;
dataGrid2.CanUserAddRows = false;
//dataGrid2.Controls[0].BackColor = Color.Gray;
}
public override void OnUnloaded() { }
public override void OnVariableStateChanged(VariableState state) { }
public override void OnAlarmChanged(AlarmInfo alarm) { }
public override void OnIdle() { }
protected override void OnMouseDoubleClick(MouseButtonEventArgs e) { base.OnMouseDoubleClick(e); }
]]></app:CData>
    </app:ActionAnim>
  </app:SynoItem.AnimationItems>
  <DataGrid x:Name="dataGrid" Width="912" Height="793" Margin="68,258,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" Canvas.Left="-36" Canvas.Top="-184">
    <DataGrid.ColumnHeaderStyle>
      <Style TargetType="System.Windows.Controls.Primitives.DataGridColumnHeader">
        <Setter Property="System.Windows.Documents.TextElement.Foreground">
          <Setter.Value>
            <SolidColorBrush>#FF000000</SolidColorBrush>
          </Setter.Value>
        </Setter>
      </Style>
    </DataGrid.ColumnHeaderStyle>
    <DataGrid.ItemBindingGroup>
      <BindingGroup x:Name="{x:Null}" NotifyOnValidationError="False" ValidatesOnNotifyDataError="True" SharesProposedValues="True" />
    </DataGrid.ItemBindingGroup>
    <DataGrid.ItemContainerStyle>
      <Style TargetType="System.Windows.Controls.DataGridRow">
        <Setter Property="System.Windows.Documents.TextElement.Foreground">
          <Setter.Value>
            <SolidColorBrush>#FF000000</SolidColorBrush>
          </Setter.Value>
        </Setter>
      </Style>
    </DataGrid.ItemContainerStyle>
  </DataGrid>
  <DataGrid x:Name="dataGrid2" Width="282" Height="717" Margin="68,258,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" Canvas.Left="896" Canvas.Top="-184">
    <DataGrid.ColumnHeaderStyle>
      <Style TargetType="System.Windows.Controls.Primitives.DataGridColumnHeader">
        <Setter Property="System.Windows.Documents.TextElement.Foreground">
          <Setter.Value>
            <SolidColorBrush>#FF000000</SolidColorBrush>
          </Setter.Value>
        </Setter>
      </Style>
    </DataGrid.ColumnHeaderStyle>
    <DataGrid.ItemBindingGroup>
      <BindingGroup x:Name="{x:Null}" NotifyOnValidationError="False" ValidatesOnNotifyDataError="True" SharesProposedValues="True" />
    </DataGrid.ItemBindingGroup>
    <DataGrid.ItemContainerStyle>
      <Style TargetType="System.Windows.Controls.DataGridRow">
        <Setter Property="System.Windows.Documents.TextElement.Foreground">
          <Setter.Value>
            <SolidColorBrush>#FF000000</SolidColorBrush>
          </Setter.Value>
        </Setter>
      </Style>
    </DataGrid.ItemContainerStyle>
  </DataGrid>
  <app:ButtonItem Text="Commit changes" Fill="#FF808080" Foreground="#FF000000" FontSize="24" x:Name="ButtonItem1" Width="280" Height="60" ToolTip="click to commit and activate changes" Canvas.Left="962" Canvas.Top="804">
    <app:SynoItem.AnimationItems>
      <app:ActionAnim x:Key="MouseLeftButtonUp">
        <app:CData xml:space="preserve"><![CDATA[ResponsiblesEditor.commitChangesClick(responsibles,parameters);
]]></app:CData>
      </app:ActionAnim>
    </app:SynoItem.AnimationItems>
  </app:ButtonItem>
  <app:RectangleItem Text="WorkFlow responsibles editor" Fill="{x:Null}" BorderThickness="0,0,0,0" Foreground="#FF938953" FontSize="36" FontStyle="Normal" FontWeight="Normal" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" x:Name="RectangleItem1" Width="1232" Height="52" Canvas.Left="23" Canvas.Top="16"></app:RectangleItem>
  <app:RectangleItem CornerRadius="10" Fill="#FFDDD9C2" Foreground="#FF000000" x:Name="RectangleItem2" Width="1256" Height="876" Canvas.ZIndex="-1" Canvas.Left="11" Canvas.Top="13"></app:RectangleItem>
</app:Synoptic>

问题似乎正在此行发生:     样式TargetType =“ System.Windows.Controls.Primitives.DataGridColumnHeader”

对于组合框项目,样式标签中的targettype也是如此。

  <ComboBox x:Name="cBox" Width="149.8192" Height="22" 
Canvas.Left="23.7296000000033" Canvas.Top="40.7904000000016" 
Foreground="Black">
  <ComboBox.ItemContainerStyle>
            <Style TargetType="{x:Type ComboBoxItem}">
                <Setter Property="Foreground" Value="Black" />
            </Style>
        </ComboBox.ItemContainerStyle>
 </ComboBox>

0 个答案:

没有答案