2013-09-05 2 views
0

DesignData를 사용하여 디자인 타임에 ItemsControl을 채려고합니다.d : DesignData FileNotFoundException

/DesignData/SampleAlerts.xaml이 파일의 내용 :

<ext:AlertSource 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" 
      xmlns:ext="http://schemas.osterwalder.com/extensions" 
      mc:Ignorable="d" d:IsDataSource="true" Guid="4D0E0886-575C-42F2-A777-2A36AB826D14" Name="Sample Alerts"> 
<ext:AlertSource.Alerts> 
    <ext:AlertBase Cause="sdlfkhjsdlkfj" Id="0" IsActive="True" IsAutoReset="False" IsOwnerAlive="False" Message="skdjfhsdakjhf" Removal="skjfdhkjsdfhs" Severity="SystemFault" Source="{x:Null}"/> 
    <ext:AlertBase Cause="sdlfkhjsdlkfj" Id="0" IsActive="True" IsAutoReset="False" IsOwnerAlive="False" Message="skdjfhsdakjhf" Removal="skjfdhkjsdfhs" Severity="EmergencyStop" Source="{x:Null}"/> 
    <ext:AlertBase Cause="sdlfkhjsdlkfj" Id="0" IsActive="True" IsAutoReset="False" IsOwnerAlive="False" Message="skdjfhsdakjhf" Removal="skjfdhkjsdfhs" Severity="ImmediateStop" Source="{x:Null}"/> 
    <ext:AlertBase Cause="sdlfkhjsdlkfj" Id="0" IsActive="True" IsAutoReset="False" IsOwnerAlive="False" Message="skdjfhsdakjhf" Removal="skjfdhkjsdfhs" Severity="CycleStop" Source="{x:Null}"/> 
    <ext:AlertBase Cause="sdlfkhjsdlkfj" Id="0" IsActive="True" IsAutoReset="False" IsOwnerAlive="False" Message="skdjfhsdakjhf" Removal="skjfdhkjsdfhs" Severity="Warning" Source="{x:Null}"/> 
</ext:AlertSource.Alerts> 

그리고 /DesignData/SampleAlerts.xaml이 DesignData로 설정 파일의 빌드 작업입니다. 모든 것이 잘 구축

<CollectionViewSource x:Key="AlertGroups" 
          mc:Ignorable="d" d:DesignSource="{d:DesignData Source=/DesignData/SampleAlerts.xaml}"> 
     <CollectionViewSource.GroupDescriptions> 
      <PropertyGroupDescription PropertyName="Severity"/> 
     </CollectionViewSource.GroupDescriptions> 
     <CollectionViewSource.SortDescriptions> 
      <scm:SortDescription PropertyName="Severity" Direction="Descending"/> 
     </CollectionViewSource.SortDescriptions> 
    </CollectionViewSource> 

으로 VisualStudio에서,하지만 난 비주얼 스튜디오 디자이너에서 다음과 같은 예외가 얻을 : 또한

The resource 'file:///C:/Users/reto/Documents/Visual Studio 2010/Projects/PPS/HMI/DesignData/SampleAlerts.xaml#3' could not be found. It should be located at 'C:\Users\reto\Documents\Visual Studio 2010\Projects\PPS\HMI\DesignData\SampleAlerts.xaml#3' but the file is not present. 
    at MS.Internal.Providers.VSExternalResourceProvider.GetTextModel(String uri, FileModel relativeTo) 
    at MS.Internal.Host.Isolation.Adapters.ContextToProtocolAdapter.MS.Internal.Host.Isolation.Protocols.IExternalResourceProtocol.GetTextModel(String uri, IFileModel relativeTo) 
    at MS.Internal.Host.Isolation.Protocols.IExternalResourceProtocol.GetTextModel(String uri, IFileModel relativeTo) 
    at MS.Internal.Host.Isolation.Adapters.ToExternalResourceAdapter.GetTextModel(String uri, FileModel relativeTo) 
    at MS.Internal.Host.MarkupProjectContext.GetMarkupResourceImpl(Uri uri) 
    at MS.Internal.Host.MarkupProjectContext.GetMarkupResource(Uri uri) 
    at Microsoft.Windows.Design.DocumentModel.MarkupDocumentManagerBase.TreeChangeListener.Microsoft.Windows.Design.DocumentModel.IDocumentTreeConsumer.HandleMessage(DocumentTreeCoordinator sender, MessageKey key, MessageArguments args) 
    at Microsoft.Windows.Design.DocumentModel.MarkupDocumentManagerBase.CancelableDocumentTreeCoordinator.RouteMessage[T](IDocumentTreeConsumer consumer, MessageKey`1 key, T args) 
    at Microsoft.Windows.Design.DocumentModel.DocumentTreeCoordinator.SendMessage[T](MessageKey`1 key, T args, Boolean isPrivateMessage) 
    at Microsoft.Windows.Design.DocumentModel.DocumentTreeCoordinator.SendMessage[T](MessageKey`1 key, T args) 
    at Microsoft.Windows.Design.DocumentModel.DocumentTreeCoordinator.QueryValue[TResult,TParameter](QueryKey`2 key, IDocumentTreeConsumer consumer, TParameter parameter) 
    at Microsoft.Windows.Design.Platform.ViewProducerBase.MS.Internal.Platform.IResourceResolver.GetMarkupResource(Uri uri) 
    at MS.Internal.Platform.CiderProjectContext.ResolveMarkupResource(Uri uri, Func`2 fallbackResolver) 
    at Microsoft.Windows.Design.Platform.ViewProducerBase.GetExternalView(String path) 
    at Microsoft.Windows.Design.Platform.ViewProducerBase.Microsoft.Expression.DesignModel.DocumentModel.IDocumentRootResolver.GetDocumentRoot(String path) 
    at Microsoft.Expression.DesignModel.InstanceBuilders.DesignDataInstanceBuilder.Instantiate(IInstanceBuilderContext context, ViewNode viewNode) 
    at Microsoft.Expression.DesignModel.Core.ViewNodeManager.Instantiate(ViewNode viewNode) 

내가 UI에서이 설계 데이터를 사용하려고

블렌드 eveything 잘 빌드하지만 디자이너가 다음과 같은 오류를 보여줍니다. - 형식 'AlertSource'추상 및 명시 적 값이 있어야합니다. Ln 1 Col 0 - 회원 '경고'가 인식되지 않거나 액세스 할 수 없습니다.

public abstract class AlertBase : IAlert 
{ 
    public long Id { get { ... } } 

    public abstract object Message { get; } 

    public abstract object GetLocalizedMessage(CultureInfo culture); 

    public abstract object Cause { get; } 

    public abstract object GetLocalizedCause(CultureInfo culture); 

    public abstract object Removal { get; } 

    public abstract object GetLocalizedRemoval(CultureInfo culture); 

    public AlertSource Source { get { ... } } 
    AlertSource IAlert.Source { get { ... } } 

    public bool IsOwnerAlive { get { ... } } 

    public bool IsActive { get { ... } set { ... } } 

    public abstract bool IsAutoReset { get; } 

    public abstract AlertSeverity Severity { get; } 

    public void Acknowledge() { ... } 

    public AlertBase(long id, AlertSource owner) { ... } 

    public event EventHandler Set; 

    public event EventHandler Reset; 

    public event EventHandler Acknowledged; 
} 

public abstract class AlertSource : IAlertSource 
{ 
    public abstract Guid Guid { get; } 

    public abstract string Name { get; } 

    public ICollection<IAlert> Alerts { get { ... } } 

    public AlertSource() { ... } 

    public virtual bool Acknowledge(IAlert alert) { ... } 

    public event NotifyCollectionChangedEventHandler CollectionChanged; 

    public event EventHandler AlertSet; 
    public event EventHandler AlertReset; 
    public event EventHandler AlertAcknowledged; 

    public IEnumerator<IAlert> GetEnumerator() { ... } 

    IEnumerator IEnumerable.GetEnumerator() { ... } 
} 

누군가가이 문제를 해결하는 방법을 알고 있나요 : 골 4

타입 AlertSource 및 AlertBase 7 속에는 다음과 같은 skelettons와 추상 클래스는?

답변

0

그것은 단지 이상한 WPF 컴파일러 오류이며 일단 프로젝트를 만들면 사라집니다. WPF XAML 코드 오류와 관련이없는 하나의 단일 오류라도 WPF에서 이러한 이상한 오류가 발생할 수 있습니다.

XAML에서 오류를 일으키는 모든 줄을 프로젝트 컴파일을 차단하는 원래 오류보다 먼저 주석 처리하는 것이 좋습니다. XAML에서 줄의 주석 처리를 제거합니다.