質問編集履歴
2
意図的に内容を抹消する行為にあたるため
title
CHANGED
File without changes
|
body
CHANGED
@@ -1,11 +1,57 @@
|
|
1
|
+
### 前提・実現したいこと
|
1
|
-
|
2
|
+
WPFでデータバインドで画像、図形をMVVM形式で表示したい
|
2
|
-
|
3
|
+
環境: Win10 、VS2019、C#
|
3
|
-
|
4
|
+
フレームワーク:Prism、ReactiveProperty
|
4
|
-
|
5
|
+
現在はMVVM形式以前の最小の構成で画像を表示することも出来ない状態です。
|
5
|
-
|
6
|
+
データバインドして画像、図形の表示について参考になるページ等
|
6
|
-
|
7
|
+
有りましたらアドバイスをお願いします。
|
7
|
-
|
8
|
+
### 該当のソースコード
|
8
|
-
|
9
|
+
MainWindow.xaml
|
9
|
-
|
10
|
+
```ザムル
|
10
|
-
|
11
|
+
<Window x:Class="DrawCircle.Views.MainWindow"
|
12
|
+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
13
|
+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
14
|
+
xmlns:prism="http://prismlibrary.com/"
|
15
|
+
prism:ViewModelLocator.AutoWireViewModel="True"
|
16
|
+
Title="{Binding Title}" Height="200" Width="300"
|
17
|
+
WindowStartupLocation="CenterScreen">
|
18
|
+
<Grid>
|
19
|
+
<StackPanel>
|
20
|
+
<Image Source="{Binding Bitmap.Value }" Height="180" Width="290" />
|
21
|
+
<ContentControl prism:RegionManager.RegionName="ContentRegion" />
|
22
|
+
</StackPanel>
|
23
|
+
</Grid>
|
24
|
+
</Window>
|
25
|
+
```
|
26
|
+
MainWindow.xaml.cs
|
27
|
+
```C#
|
28
|
+
using System.Windows;
|
29
|
+
using Reactive.Bindings;
|
30
|
+
using System.Windows.Media.Imaging;
|
31
|
+
using System;
|
32
|
+
namespace DrawCircle.Views
|
11
|
-
|
33
|
+
{
|
34
|
+
/// <summary>
|
35
|
+
/// Interaction logic for MainWindow.xaml
|
36
|
+
/// </summary>
|
37
|
+
public partial class MainWindow : Window
|
38
|
+
{
|
39
|
+
public ReactiveProperty<BitmapImage> Bitmap{ set; get; }
|
40
|
+
public ReactiveProperty<BitmapImage> rp_image1 { set; get; }
|
41
|
+
public MainWindow()
|
42
|
+
{
|
43
|
+
InitializeComponent();
|
44
|
+
BitmapImage image1 = new BitmapImage(new Uri(@"C:\Test\hoge.jpg"));
|
45
|
+
rp_image1 = new ReactiveProperty<BitmapImage>(image1);
|
46
|
+
Bitmap = rp_image1;
|
47
|
+
}
|
48
|
+
}
|
49
|
+
}
|
50
|
+
```
|
51
|
+
|
52
|
+
### 試したこと
|
53
|
+
ボタン、テキストボックスのデータバインドと比べて画像表示系の
|
54
|
+
実例が無いため何が問題なのか理解できない状態です。
|
55
|
+
### 補足情報(FW/ツールのバージョンなど)
|
56
|
+
Win10 、VS2019、C#
|
57
|
+
Prism、ReactiveProperty
|
1
都合により削除することとなりました。
title
CHANGED
File without changes
|
body
CHANGED
@@ -1,63 +1,11 @@
|
|
1
|
-
### 前提・実現したいこと
|
2
|
-
|
1
|
+
まことにすみませんが事情により削除することとなりました
|
3
|
-
環境: Win10 、VS2019、C#
|
4
|
-
フレームワーク:Prism、ReactiveProperty
|
5
2
|
|
6
|
-
現在はMVVM形式以前の最小の構成で画像を表示することも出来ない状態です。
|
7
|
-
データバインドして画像、図形の表示について参考になるページ等
|
8
|
-
有りましたらアドバイスをお願いします。
|
9
3
|
|
10
|
-
### 該当のソースコード
|
11
|
-
MainWindow.xaml
|
12
|
-
```ザムル
|
13
|
-
<Window x:Class="DrawCircle.Views.MainWindow"
|
14
|
-
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
15
|
-
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
16
|
-
xmlns:prism="http://prismlibrary.com/"
|
17
|
-
prism:ViewModelLocator.AutoWireViewModel="True"
|
18
|
-
Title="{Binding Title}" Height="200" Width="300"
|
19
|
-
WindowStartupLocation="CenterScreen">
|
20
|
-
<Grid>
|
21
|
-
<StackPanel>
|
22
|
-
<Image Source="{Binding Bitmap.Value }" Height="180" Width="290" />
|
23
|
-
<ContentControl prism:RegionManager.RegionName="ContentRegion" />
|
24
|
-
</StackPanel>
|
25
|
-
</Grid>
|
26
|
-
</Window>
|
27
|
-
```
|
28
|
-
MainWindow.xaml.cs
|
29
|
-
```C#
|
30
|
-
using System.Windows;
|
31
|
-
using Reactive.Bindings;
|
32
|
-
using System.Windows.Media.Imaging;
|
33
|
-
using System;
|
34
4
|
|
35
|
-
namespace DrawCircle.Views
|
36
|
-
{
|
37
|
-
/// <summary>
|
38
|
-
/// Interaction logic for MainWindow.xaml
|
39
|
-
/// </summary>
|
40
|
-
public partial class MainWindow : Window
|
41
|
-
{
|
42
|
-
public ReactiveProperty<BitmapImage> Bitmap{ set; get; }
|
43
|
-
public ReactiveProperty<BitmapImage> rp_image1 { set; get; }
|
44
5
|
|
45
|
-
public MainWindow()
|
46
|
-
{
|
47
|
-
InitializeComponent();
|
48
6
|
|
49
|
-
BitmapImage image1 = new BitmapImage(new Uri(@"C:\Test\hoge.jpg"));
|
50
|
-
rp_image1 = new ReactiveProperty<BitmapImage>(image1);
|
51
|
-
Bitmap = rp_image1;
|
52
|
-
}
|
53
|
-
}
|
54
|
-
}
|
55
|
-
```
|
56
|
-
|
57
|
-
### 試したこと
|
58
|
-
ボタン、テキストボックスのデータバインドと比べて画像表示系の
|
59
|
-
実例が無いため何が問題なのか理解できない状態です。
|
60
7
|
|
61
|
-
|
8
|
+
|
9
|
+
|
10
|
+
|
62
|
-
|
11
|
+
。
|
63
|
-
Prism、ReactiveProperty
|