저는 WPF 및 XAML의 초보자이며 이미 배워야 할 것을 후회하고 있습니다. 처음. 아래 코드를 실행하는 데 오류가 발생하는 이유를 모르겠습니다. WPF 4에서 직접 코드를 복사했습니다. 너희들 중 하나가이 계산에 나를 도울 수 있다면 우리의 내가 너희들에게 큰 호의를 빚을 것'FactoryMethod'특성이 XML 네임 스페이스 'http://schemas.microsoft.com/winfx/2006/xaml'에 존재하지 않습니다.
<Window x:Class="WpfApplication1.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:System="clr-namespace:System;assembly=mscorlib"
xmlns:collections="clr-namespace:System.Collections;assembly=mscorlib"
xmlns:Person="clr-namespace:Src"
Title="MainWindow" Height="354" Width="525">
<StackPanel>
<Label Name="lblText" Foreground="BlanchedAlmond" FontWeight="Bold" FontSize="20">
Test
</Label>
<Label x:FactoryMethod="System:Guid.NewGuid">Test2</Label>
<ListBox SelectionChanged="ListBox_SelectionChanged">
<Person:Person FirstName="Deepak" LastName="Sharma"></Person:Person>
<Person:Person FirstName="Nidhi" LastName="Sharma"></Person:Person>
</ListBox>
</StackPanel>
</Window>
잘못된 코드는 유감이지만 FactoryMethod에 대해 더 우려하고 있습니다. Visual Studio 2010에서 .NET 4.0 빌드의 WPF 응용 프로그램에서 팩토리 메서드를 사용할 수없는 이유가 확실하지 않습니다. XAMLPad 또는 일부 타사 응용 프로그램과 같은 것을 사용해야한다는 의미입니까? – dpak
컴파일되지 않은 XAML에서 컨트롤을 생성해야합니다. 예를 들어 'XamlReader'로 수행 할 수 있지만 컴파일 된 XAML **에서 지원 될 때까지는 그다지 신경 쓰지 않아도됩니다. 그렇지 않으면 상당히 쓸모가 없습니다. –
x : Arguments 태그를 사용하여 비슷한 오류가 발생합니다. 같은 문제로 인한 것입니까? – dpak