2013-07-26 3 views
2

나는 모양을 가지고 있지만이 오류에 대한 대답을 찾을 수 없습니다.ObjectDataProvider wpf 로컬 형식을 찾을 수 없음

여기이 문서를 통해 CodeProject Datagrid practical example 작업 나는 내가 인스턴스화로 사용되는 객체를 얻기 위해 노력하고 생각

에 새로운 오전 WPF에서 내 간단한 CRUD 화면의 코드를 수정하는 것을 시도하고있다 데이터 그리드에 데이터 소스 하지만 내 마크 업 빌드에 나는 분명히 이해가 안되는 다음과 같은 오류가 발생합니다.

나는 내 XAML 키의 objectdataprovider이 CustomerScheduleDataProvider의 클래스이고 예를 마크 업이 코드의 CustomerDataProvider 부분은 내가 대체 어디로되는 경우 유형, 생성자, 그러나 명확하지 생각 내 클래스 이름

누군가가 내가 뭘 놓친 거지, 많은 감사 이안

을 지적 주실 래요

'local : CustomerScheduleDataProvider'유형을 찾을 수 없습니다. MS.Internal.Platform.MemberDocumentValueSerializer`1.ConvertToDocumentValue (ITypeMetadata 타입 문자열 값 IServiceProvider documentServices) MS.Internal.Design.DocumentModel.DocumentTrees.Markup.XamlMarkupExtensionPropertyBase.get_Value에서 ()에서 MS.Internal.Design 에서 . MS.Internal.Design.DocumentModel.DocumentTrees.InMemory.InMemoryDocumentProperty..ctor에서 DocumentModel.DocumentTrees.DocumentPropertyWrapper.get_Value() (DocumentProperty 속성, InMemoryDocumentItem 항목) MS.Internal.Design.DocumentModel.DocumentTrees.InMemory.InMemoryDocumentItem에서 . SetUpItem (DocumentItem item)

여기 내 마크 업과 코드입니다. 내 경험은 경험 많은 코더들에 의해 놓친 이들이며 우리 초보자들은 우리가 사용해야하는 것을 깨닫지 못한다!

<Window 

xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 

xmlns:dg="http://schemas.microsoft.com/wpf/2008/toolkit" 
Title="Customer Forecast Input" Height="300" Width="600"> 

<Window.Resources> 
    <!-- create an instance of our DataProvider class --> 
    <ObjectDataProvider x:Key="CustomerScheduleDataProvider" 
     ObjectType="{x:Type local:CustomerScheduleDataProvider}"/> 

    <!-- define the method which is invoked to obtain our data --> 
    <ObjectDataProvider x:Key="CustomerSchedule" 
     ObjectInstance="{StaticResource CustomerScheduleDataProvider}" 
     MethodName="GetCustomerSchedules"/> 
</Window.Resources> 

<DockPanel DataContext="{Binding Source={StaticResource CustomerSchedule}}"> 
    <dg:DataGrid ItemsSource="{Binding}" Name="dataGrid"/> 
</DockPanel> 
</Window> 

using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Text; 
using System.Data; 
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; 
namespace CustomerForecastInput 
{ 
    public class CustomerScheduleDataProvider 
    { 
    private SysproCompanyTDataSetTableAdapters.CustomerSchedulesTableAdapter CSadapter; 
    private SysproCompanyTDataSet ds; 

    public CustomerScheduleDataProvider() 
    { 
     ds = new SysproCompanyTDataSet(); 
     CSadapter = new SysproCompanyTDataSetTableAdapters.CustomerSchedulesTableAdapter(); 
     CSadapter.Fill(ds.CustomerSchedules); 
    } 
    public DataView GetCustomerSchedules() 
    { 
     return ds.CustomerSchedules.DefaultView; 

    } 
} 
} 

답변

2

XAML에서 네임 스페이스를 사용하기 전에 선언하지 않았습니다. 그래서 아래의 선언을 Window 태그에 넣으십시오.

xmlns:local="clr-namespace:CustomerForecastInput"