質問編集履歴
1
試したことを追加しました
title
CHANGED
File without changes
|
body
CHANGED
@@ -3,4 +3,73 @@
|
|
3
3
|
|
4
4
|
を参考にWPFを追加する事はできたのですが、それにNugetパッケージのPrismを適用する方法がわかりませんでした。
|
5
5
|
|
6
|
-
無理なんゃないかとも思い始めていますが、もしご存知の方がいらっしゃいましたらご教授ください。
|
6
|
+
無理なんゃないかとも思い始めていますが、もしご存知の方がいらっしゃいましたらご教授ください。
|
7
|
+
|
8
|
+
以下が試したことです。
|
9
|
+
|
10
|
+
・PrismのテンプレートからXamarin.Formsを作成する
|
11
|
+
・Nugetパッケージから更新プログラムを全て最新にする
|
12
|
+
・ソリューション→右クリック→追加→新しいプロジェクト
|
13
|
+
・Visual C#→Windows デスクトップ→WPFアプリ(.NET Framework)
|
14
|
+
・参照を一つ下の階層に変更。名称は.WPFを付ける。フレームワークは4.7を選択してOK
|
15
|
+
・WPFプロジェクト→参照を右クリック→参照の追加
|
16
|
+
・プロジェクト→ソリューション→PCLにチェック→OK
|
17
|
+
・NugetパッケージからXamarin.Forms.Platform.WPFをWPFプロジェクトに適用
|
18
|
+
・NugetパッケージからPrism.Dryloc.Formsを全プロジェクトに適用
|
19
|
+
MainWindow.xaml.cs
|
20
|
+
```C#
|
21
|
+
namespace XFWPF.WPF
|
22
|
+
{
|
23
|
+
/// <summary>
|
24
|
+
/// MainWindow.xaml の相互作用ロジック
|
25
|
+
/// </summary>
|
26
|
+
public partial class MainWindow : Xamarin.Forms.Platform.WPF.FormsApplicationPage
|
27
|
+
{
|
28
|
+
public MainWindow()
|
29
|
+
{
|
30
|
+
InitializeComponent();
|
31
|
+
Xamarin.Forms.Forms.Init();
|
32
|
+
LoadApplication(new XFWPF.App(new WpfInitializer()));
|
33
|
+
}
|
34
|
+
|
35
|
+
public class WpfInitializer : IPlatformInitializer
|
36
|
+
{
|
37
|
+
public void RegisterTypes(IContainerRegistry containerRegistry)
|
38
|
+
{
|
39
|
+
// Register any platform specific implementations
|
40
|
+
}
|
41
|
+
}
|
42
|
+
|
43
|
+
}
|
44
|
+
}
|
45
|
+
```
|
46
|
+
|
47
|
+
MainWindow.xaml
|
48
|
+
```Xaml
|
49
|
+
<xf:FormsApplicationPage
|
50
|
+
x:Class="XFWPF.WPF.MainWindow"
|
51
|
+
xmlns:xf="clr-namespace:Xamarin.Forms.Platform.WPF;assembly=Xamarin.Forms.Platform.WPF"
|
52
|
+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
53
|
+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
54
|
+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
55
|
+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
56
|
+
xmlns:local="clr-namespace:XFWPF.WPF"
|
57
|
+
mc:Ignorable="d"
|
58
|
+
Title="MainWindow" Height="450" Width="800">
|
59
|
+
<Grid>
|
60
|
+
|
61
|
+
</Grid>
|
62
|
+
</xf:FormsApplicationPage>
|
63
|
+
```
|
64
|
+
|
65
|
+
では以下のエラーが出てダメでした。
|
66
|
+
|
67
|
+
System.Windows.Markup.XamlParseException
|
68
|
+
HResult=0x80131501
|
69
|
+
Message='指定されたバインディング制約に一致する型 'XFWPF.WPF.MainWindow' のコンストラクターの呼び出しで例外がスローされました。' 行番号 '8'、行位置 '5'。
|
70
|
+
Source=PresentationFramework
|
71
|
+
スタック トレース:
|
72
|
+
場所 System.Windows.Markup.WpfXamlLoader.Load(XamlReader xamlReader, IXamlObjectWriterFactory writerFactory, Boolean skipJournaledProperties, Object rootObject, XamlObjectWriterSettings settings, Uri baseUri)
|
73
|
+
|
74
|
+
内部例外 1:
|
75
|
+
TypeLoadException: アセンブリ 'Prism, Version=7.1.0.431, Culture=neutral, PublicKeyToken=40ee6c3a2184dc59' から型 'Prism.Navigation.INavigationService' を読み込めませんでした。
|