teratail header banner
teratail header banner
質問するログイン新規登録

回答編集履歴

1

見直しキャンペーン中

2023/07/23 05:00

投稿

TN8001
TN8001

スコア10108

answer CHANGED
@@ -1,67 +1,67 @@
1
- 普通に通りますけど。。Releaseモードってことはないですよね?
2
-
3
- ```xaml
4
- <Window
5
- x:Class="Questions288263.Views.MainWindow"
6
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
7
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
8
- xmlns:behaviors="http://schemas.microsoft.com/xaml/behaviors"
9
- xmlns:l="http://schemas.livet-mvvm.net/2011/wpf"
10
- xmlns:v="clr-namespace:Questions288263.Views"
11
- xmlns:vm="clr-namespace:Questions288263.ViewModels"
12
- Title="MainWindow"
13
- Width="525"
14
- Height="350">
15
-
16
- <Window.DataContext>
17
- <vm:EntryViewModel />
18
- </Window.DataContext>
19
-
20
- <behaviors:Interaction.Triggers>
21
- <behaviors:EventTrigger EventName="ContentRendered">
22
- <l:LivetCallMethodAction MethodName="Initialize" MethodTarget="{Binding}" />
23
- </behaviors:EventTrigger>
24
- <behaviors:EventTrigger EventName="Closed">
25
- <l:DataContextDisposeAction />
26
- </behaviors:EventTrigger>
27
- </behaviors:Interaction.Triggers>
28
-
29
- <Grid>
30
- <TextBox Text="{Binding ItemCodeText, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
31
- </Grid>
32
- </Window>
33
- ```
34
-
35
- ```C#
36
- using System.Diagnostics;
37
- using Livet;
38
-
39
- namespace Questions288263.ViewModels
40
- {
41
- public class EntryViewModel : ViewModel
42
- {
43
- private string _ItemCodeText;
44
-
45
- public string ItemCodeText
46
- {
47
- get { return _ItemCodeText; }
48
- set
49
- {
50
- // これ意味ありますか??
51
- if(_ItemCodeText == null)
52
- {
53
- _ItemCodeText = ItemCodeText;
54
- }
55
-
56
- if(_ItemCodeText == value) return;
57
-
58
- Debug.WriteLine($"set ItemCodeText={value}");
59
- _ItemCodeText = value;
60
- RaisePropertyChanged();
61
- }
62
- }
63
-
64
- public void Initialize() { }
65
- }
66
- }
1
+ 普通に通りますけど。。Releaseモードってことはないですよね?
2
+
3
+ ```xml
4
+ <Window
5
+ x:Class="Questions288263.Views.MainWindow"
6
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
7
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
8
+ xmlns:behaviors="http://schemas.microsoft.com/xaml/behaviors"
9
+ xmlns:l="http://schemas.livet-mvvm.net/2011/wpf"
10
+ xmlns:v="clr-namespace:Questions288263.Views"
11
+ xmlns:vm="clr-namespace:Questions288263.ViewModels"
12
+ Title="MainWindow"
13
+ Width="525"
14
+ Height="350">
15
+
16
+ <Window.DataContext>
17
+ <vm:EntryViewModel />
18
+ </Window.DataContext>
19
+
20
+ <behaviors:Interaction.Triggers>
21
+ <behaviors:EventTrigger EventName="ContentRendered">
22
+ <l:LivetCallMethodAction MethodName="Initialize" MethodTarget="{Binding}" />
23
+ </behaviors:EventTrigger>
24
+ <behaviors:EventTrigger EventName="Closed">
25
+ <l:DataContextDisposeAction />
26
+ </behaviors:EventTrigger>
27
+ </behaviors:Interaction.Triggers>
28
+
29
+ <Grid>
30
+ <TextBox Text="{Binding ItemCodeText, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
31
+ </Grid>
32
+ </Window>
33
+ ```
34
+
35
+ ```cs
36
+ using System.Diagnostics;
37
+ using Livet;
38
+
39
+ namespace Questions288263.ViewModels
40
+ {
41
+ public class EntryViewModel : ViewModel
42
+ {
43
+ private string _ItemCodeText;
44
+
45
+ public string ItemCodeText
46
+ {
47
+ get { return _ItemCodeText; }
48
+ set
49
+ {
50
+ // これ意味ありますか??
51
+ if(_ItemCodeText == null)
52
+ {
53
+ _ItemCodeText = ItemCodeText;
54
+ }
55
+
56
+ if(_ItemCodeText == value) return;
57
+
58
+ Debug.WriteLine($"set ItemCodeText={value}");
59
+ _ItemCodeText = value;
60
+ RaisePropertyChanged();
61
+ }
62
+ }
63
+
64
+ public void Initialize() { }
65
+ }
66
+ }
67
67
  ```