2016-06-20 5 views
1

私は奇妙な問題を少し考えています。私は2つがしかし、奇妙なことは、プロジェクトのビルドさ/うまくコンパイルし、それが必要として実行されたエラーは現在のコンテキストエラーに存在しませんが、ファインコンパイル

Error 1 The name 'employeeDetails' does not exist in the current context c:\users\kelly\documents\visual studio 2013\projects\insurance midam interface\insurance midam interface\mainwindow.xaml.cs 72 17 Insurance MidAm Interface 
Error 2 The name 'searchBox' does not exist in the current context c:\users\kelly\documents\visual studio 2013\projects\insurance midam interface\insurance midam interface\mainwindow.xaml.cs 80 34 Insurance MidAm Interface 

「現在のコンテキスト内に存在しない」受け付けております。それは、このエラーのために、私は持っていると思うオブジェクトにIntelliSenseを取得していないと言われています。

私は最近、XAMLを大幅に編集しました。その前にエラーが表示されていなかったため、これと関連があると推測します(実際には 'employeeDetails'は存在しませんでしたが 'searchBox'でした)。グリッドとテキストボックスは明らかに基本的なコントロールなので、参照や名前空間でどのようにエラーになるかわかりません。

私は本当に助けに感謝します。

関連CS:

private void viewButton_Click(object sender, RoutedEventArgs e) { 


      DataRowView selectedValue = (DataRowView)employeeGrid.SelectedItem; 
      MessageBox.Show(selectedValue.Row[0].ToString()); 

       employeeGrid.Visibility = Visibility.Collapsed; 
       employeeDetails.Visibility = Visibility.Visible; 



     } 

     private void searchBox_TextChanged(object sender, TextChangedEventArgs e) 
     { 
      String currentText = searchBox.Text; 
      ds.Tables["Employees"].DefaultView.RowFilter = "last like '" + currentText + "*'"; 
     } 
    } 
} 

およびXAML(長さについては申し訳ありませんが、私は、私はそれをトリミングした場合、私はおそらくトラブルコードを削除することができることを恐れています):

<Window 
     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
     xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:Insurance_MidAm_Interface" mc:Ignorable="d" x:Class="Insurance_MidAm_Interface.MainWindow" 
     Title="View Employees" Height="700" Width="1000" Loaded="Window_Loaded" SizeToContent="WidthAndHeight" WindowStartupLocation="CenterScreen" WindowState="Maximized"> 

    <StackPanel Name="outerPanel"> 
     <Grid Visibility="Collapsed" Name="employeeDetails" > 
      <Grid.ColumnDefinitions> 
       <ColumnDefinition Width="*"></ColumnDefinition> 
       <ColumnDefinition Width="*"></ColumnDefinition> 
       <ColumnDefinition Width="*"></ColumnDefinition> 
      </Grid.ColumnDefinitions> 
      <Grid.RowDefinitions> 
       <RowDefinition Height="*"></RowDefinition> 
       <RowDefinition Height="50"></RowDefinition> 
       <RowDefinition Height="*"></RowDefinition> 
       <RowDefinition Height="*"></RowDefinition> 
       <RowDefinition Height="*"></RowDefinition> 
       <RowDefinition Height="*"></RowDefinition> 
      </Grid.RowDefinitions> 
      <StackPanel Orientation="Vertical" Grid.Row="0" Grid.Column="0"> 
       <Label Name="labelEmpSSN" Content="SSN: "></Label> <Label Name="labelEmpName" Content="Name: "></Label> 
       <Label Name="labelEmpAddress" Content="Address:"></Label> 
       <Label Name="labelEmpBirth" Content="DOB: "></Label> 
       <Label Name="labelEmpGender" Content="Gender"></Label> 
       <Label Name="labelEmpInsurance" Content="Insurance: "></Label> 
       <Label Name="labelEmpDependents" Content="Dependents: "></Label> 
       <Label Name="labelEmpLocation" Content="Location: "></Label> 
       <Label Name="labelEmpVision" Content="Vision: "></Label></StackPanel> 
      <StackPanel Orientation="Vertical" Grid.Row="0" Grid.Column="1"> 
       <Label Name="labelReportDate" Content="Date: " /> 
       <Label Name="labelReportAction" Content="Action: " />     
      </StackPanel> 
      <StackPanel Orientation="Vertical" Grid.Row="0" Grid.Column="2"> 
       <Label Name="labelSpouseName" Content="Name: "></Label> 
        <Label Name="labelSpouseGender" Content="Gender: "></Label> 
       <Label Name="labelSpouseSSN" Content="SSN: "></Label> 
       <Label Name="labelSpouseBirth" Content="DOB: "></Label> 
       <Label Name="labelSpouseAddress" Content="Address: "></Label> 
       <Label Name="labelSpouseEmployed" Content="Employed by Company: "></Label> 

      </StackPanel> 
      <Label Grid.Row="1" Grid.Column="0" Content="Children"></Label> 
      <Label Grid.Row="1" Grid.Column="1" Content="Life Beneficiaries"></Label> 
      <Label Grid.Row="1" Grid.Column="2" Content="Vision Dependents"></Label> 

      <StackPanel Orientation="Vertical" Grid.Column="0" Grid.Row="2"> 
       <Label Name="labelChildName1" Content="Name: "></Label> 
       <Label Name="labelChildSSN1" Content="SSN: "></Label> 
       <Label Name="labelChildGender1" Content="Gender: "></Label> 
       <Label Name="labelChildBirth1" Content="DOB: "></Label> 
       <Label Name="labelChildAddress1" Content="Address: "></Label> 
       <StackPanel Orientation="Horizontal"> 
        <Label Name="labelChildStep1" Content="Step:"></Label> 
        <Label Name="labelChildFost1" Content="Foster: "></Label></StackPanel> 
       <StackPanel Orientation="Horizontal"> 
        <Label Name="labelChildHandicap1" Content="Handicap: "></Label> 
        <Label Name="labelChildStudent1" Content="Student: "></Label> 
       </StackPanel> 
      </StackPanel> 

      <StackPanel Orientation="Vertical" Grid.Column="0" Grid.Row="3"> 
       <Label Name="labelChildName2" Content="Name: "></Label> 
       <Label Name="labelChildSSN2" Content="SSN: "></Label> 
       <Label Name="labelChildGender2" Content="Gender: "></Label> 
       <Label Name="labelChildBirth2" Content="DOB: "></Label> 
       <Label Name="labelChildAddress2" Content="Address: "></Label> 
       <StackPanel Orientation="Horizontal"> 
        <Label Name="labelChildStep2" Content="Step:"></Label> 
        <Label Name="labelChildFost2" Content="Foster: "></Label> 
       </StackPanel> 
       <StackPanel Orientation="Horizontal"> 
        <Label Name="labelChildHandicap2" Content="Handicap: "></Label> 
        <Label Name="labelChildStudent2" Content="Student: "></Label> 
       </StackPanel> 
      </StackPanel> 

      <StackPanel Orientation="Vertical" Grid.Column="0" Grid.Row="4"> 
       <Label Name="labelChildName3" Content="Name: "></Label> 
       <Label Name="labelChildSSN3" Content="SSN: "></Label> 
       <Label Name="labelChildGender3" Content="Gender: "></Label> 
       <Label Name="labelChildBirth3" Content="DOB: "></Label> 
       <Label Name="labelChildAddress3" Content="Address: "></Label> 
       <StackPanel Orientation="Horizontal"> 
        <Label Name="labelChildStep3" Content="Step:"></Label> 
        <Label Name="labelChildFost3" Content="Foster: "></Label> 
       </StackPanel> 
       <StackPanel Orientation="Horizontal"> 
        <Label Name="labelChildHandicap3" Content="Handicap: "></Label> 
        <Label Name="labelChildStudent3" Content="Student: "></Label> 
       </StackPanel> 
      </StackPanel> 

      <StackPanel Orientation="Vertical" Grid.Column="0" Grid.Row="5"> 
       <Label Name="labelChildName4" Content="Name: "></Label> 
       <Label Name="labelChildSSN4" Content="SSN: "></Label> 
       <Label Name="labelChildGender4" Content="Gender: "></Label> 
       <Label Name="labelChildBirth4" Content="DOB: "></Label> 
       <Label Name="labelChildAddress4" Content="Address: "></Label> 
       <StackPanel Orientation="Horizontal"> 
        <Label Name="labelChildStep4" Content="Step:"></Label> 
        <Label Name="labelChildFost4" Content="Foster: "></Label> 
       </StackPanel> 
       <StackPanel Orientation="Horizontal"> 
        <Label Name="labelChildHandicap4" Content="Handicap: "></Label> 
        <Label Name="labelChildStudent4" Content="Student: "></Label> 
       </StackPanel> 
      </StackPanel> 

      <StackPanel Orientation="Vertical" Grid.Column="0" Grid.Row="6"> 
       <Label Name="labelChildName5" Content="Name: "></Label> 
       <Label Name="labelChildSSN5" Content="SSN: "></Label> 
       <Label Name="labelChildGender5" Content="Gender: "></Label> 
       <Label Name="labelChildBirth5" Content="DOB: "></Label> 
       <Label Name="labelChildAddress5" Content="Address: "></Label> 
       <StackPanel Orientation="Horizontal"> 
        <Label Name="labelChildStep5" Content="Step:"></Label> 
        <Label Name="labelChildFost5" Content="Foster: "></Label> 
       </StackPanel> 
       <StackPanel Orientation="Horizontal"> 
        <Label Name="labelChildHandicap5" Content="Handicap: "></Label> 
        <Label Name="labelChildStudent5" Content="Student: "></Label> 
       </StackPanel> 
      </StackPanel> 

      <StackPanel Orientation="Vertical" Grid.Column="1" Grid.Row="2"> 
       <Label Name="labelBeneficiaryName1" Content="Name: "></Label> 
       <Label Name="labelBeneficiaryStatus1" Content="Status: "></Label> 
       <Label Name="labelBeneficiarySSN1" Content="SSN: "></Label> 
       <Label Name="labelBeneficiaryPercentage1" Content="Percentage: "></Label> 
       <Label Name="labelBeneficiaryRelationship1" Content="Relationship"></Label> 
      </StackPanel> 

      <StackPanel Orientation="Vertical" Grid.Column="1" Grid.Row="3"> 
       <Label Name="labelBeneficiaryName2" Content="Name: "></Label> 
       <Label Name="labelBeneficiaryStatus2" Content="Status: "></Label> 
       <Label Name="labelBeneficiarySSN2" Content="SSN: "></Label> 
       <Label Name="labelBeneficiaryPercentage2" Content="Percentage: "></Label> 
       <Label Name="labelBeneficiaryRelationship2" Content="Relationship"></Label> 
      </StackPanel> 



      <StackPanel Orientation="Vertical" Grid.Column="1" Grid.Row="4"> 
       <Label Name="labelBeneficiaryName3" Content="Name: "></Label> 
       <Label Name="labelBeneficiaryStatus3" Content="Status: "></Label> 
       <Label Name="labelBeneficiarySSN3" Content="SSN: "></Label> 
       <Label Name="labelBeneficiaryPercentage3" Content="Percentage: "></Label> 
       <Label Name="labelBeneficiaryRelationship3" Content="Relationship"></Label> 
      </StackPanel> 


      <StackPanel Orientation="Vertical" Grid.Column="1" Grid.Row="5"> 
       <Label Name="labelBeneficiaryName4" Content="Name: "></Label> 
       <Label Name="labelBeneficiaryStatus4" Content="Status: "></Label> 
       <Label Name="labelBeneficiarySSN4" Content="SSN: "></Label> 
       <Label Name="labelBeneficiaryPercentage4" Content="Percentage: "></Label> 
       <Label Name="labelBeneficiaryRelationship4" Content="Relationship"></Label> 
      </StackPanel> 

      <StackPanel Orientation="Vertical" Grid.Column="2" Grid.Row="2"> 
       <Label Name="labelVisionName1" Content="Name: "></Label> 
       <Label Name="labelVisonSSN1" Content="SSN: "></Label> 
       <Label Name="labelVisionGender1" Content="Gender: "></Label> 
       <Label Name="labelVisionBirth1" Content="DOB: "></Label>    

      </StackPanel> 

      <StackPanel Orientation="Vertical" Grid.Column="2" Grid.Row="3"> 
       <Label Name="labelVisionName2" Content="Name: "></Label> 
       <Label Name="labelVisonSSN2" Content="SSN: "></Label> 
       <Label Name="labelVisionGender2" Content="Gender: "></Label> 
       <Label Name="labelVisionBirth2" Content="DOB: "></Label> 

      </StackPanel> 

      <StackPanel Orientation="Vertical" Grid.Column="2" Grid.Row="4"> 
       <Label Name="labelVisionName3" Content="Name: "></Label> 
       <Label Name="labelVisonSSN3" Content="SSN: "></Label> 
       <Label Name="labelVisionGender3" Content="Gender: "></Label> 
       <Label Name="labelVisionBirth3" Content="DOB: "></Label> 

      </StackPanel> 

      <StackPanel Orientation="Vertical" Grid.Column="2" Grid.Row="5"> 
       <Label Name="labelVisionName4" Content="Name: "></Label> 
       <Label Name="labelVisonSSN4" Content="SSN: "></Label> 
       <Label Name="labelVisionGender4" Content="Gender: "></Label> 
       <Label Name="labelVisionBirth4" Content="DOB: "></Label> 

      </StackPanel> 

      <StackPanel Orientation="Vertical" Grid.Column="2" Grid.Row="6"> 
       <Label Name="labelVisionName5" Content="Name: "></Label> 
       <Label Name="labelVisonSSN5" Content="SSN: "></Label> 
       <Label Name="labelVisionGender5" Content="Gender: "></Label> 
       <Label Name="labelVisionBirth5" Content="DOB: "></Label> 

      </StackPanel> 

     </Grid> 
     <StackPanel Name="gridPanel"> 
     <StackPanel Orientation="Horizontal"> 
      <Label Content="Search (by last name):" Margin="10, 10"></Label> 
      <TextBox Name="searchBox" Width="150" Margin="0,10" TextChanged="searchBox_TextChanged"></TextBox> 
     </StackPanel> 
     <DataGrid AutoGenerateColumns="false" ItemsSource="{Binding}" x:Name="employeeGrid" HorizontalAlignment="Left" Margin="0" VerticalAlignment="Stretch" > 
      <DataGrid.DataContext> 
       <local:employee/> 
      </DataGrid.DataContext> 
      <DataGrid.Columns> 
       <DataGridTextColumn Header="First" Binding="{Binding first}"/> 
       <DataGridTextColumn Header="Last" Binding="{Binding last}"/> 
       <DataGridTextColumn Header="SSN" Binding="{Binding ssn}"/> 
       <DataGridTemplateColumn> 
        <DataGridTemplateColumn.CellTemplate> 
        <DataTemplate> 
          <Button Name="viewButton" Content="View Details" Click="viewButton_Click"></Button> 
        </DataTemplate> 
        </DataGridTemplateColumn.CellTemplate> 
       </DataGridTemplateColumn> 
       <DataGridTextColumn Header="Employment Location" Binding="{Binding location}"/> 
       <DataGridTextColumn Header="Email" Binding="{Binding email}"/> 
       <DataGridTextColumn Header="Address" Binding="{Binding address}"/> 
       <DataGridTextColumn Header="Insurance" Binding="{Binding decision}"/> 
       <DataGridTextColumn Header="Vision" Binding="{Binding vision}"/> 
       <DataGridTextColumn Header="Dependents" Binding="{Binding dependents}"/> 
      </DataGrid.Columns> 
     </DataGrid> 
     </StackPanel> 
    </StackPanel> 
</Window> 
+1

私はコードを見ていないが、偶然にあなたがビルドを試してみました>クリーンソリューションですか? – LukeGeneva

+0

はい、私はそれを試みましたが、残念ながら、それは動作しませんでした。とにかくありがとう! – KellyMarchewa

+1

プロジェクトの名前空間を変更しましたか? – PhilDulac

答えて

1

ソリューションのクリーニングの最中に、obj\debugフォルダをチェック/空にすることができます。私は間違っているかもしれませんが、そこにあるいくつかのファイルがVisual Studioデザイナーによって使用されていると思います。

また、thisによると、このようなカスタム名前空間宣言の終わりに;assembly=を追加すると、問題を解決することができます:

xmlns:local="clr-namespace:Insurance_MidAm_Interface;assembly=" 
+0

私はちょうどそれも試みた後、再び清掃された/ビルドされ、まだエラーを取得しています。しかし、ありがとう! – KellyMarchewa

関連する問題