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

質問編集履歴

1

クラス名と名前空間名の変更

2021/04/30 15:27

投稿

K.KATSU2
K.KATSU2

スコア10

title CHANGED
File without changes
body CHANGED
@@ -11,11 +11,11 @@
11
11
  ### 該当のソースコード
12
12
  [WindowのXaml]
13
13
  ```Xaml
14
- <Window x:Class="ApprovalFlow.Views.ApprovalFlowRegist"
14
+ <Window x:Class="TEST.Views.TESTFlowRegist"
15
15
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
16
16
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
17
17
  xmlns:prism="http://prismlibrary.com/"
18
- xmlns:views="clr-namespace:ApprovalFlow.Views"
18
+ xmlns:views="clr-namespace:TEST.Views"
19
19
  Height="360" Width="500"
20
20
  prism:ViewModelLocator.AutoWireViewModel="True">
21
21
  <Grid>
@@ -51,83 +51,9 @@
51
51
  </Window>
52
52
  ```
53
53
 
54
- [windowのViewModel]
55
- ```C#
56
- public class ApprovalFlowRegistViewModel : BindableBase
57
- {
58
- //フィールド
59
- private static int _xCode=5;
60
- private int _yCode;
61
- private int _no;
62
- Stack<Item> _stack;
63
-
64
- public ApprovalFlowRegistViewModel()
65
- {
66
- _no = 0;
67
- _yCode = 5;
68
- _items = new ObservableCollection<Item>();
69
- _stack = new Stack<Item>();
70
- AddCommand = new DelegateCommand(ExecuteAddCommand);
71
- DelCommand = new DelegateCommand(ExecuteDelCommand);
72
- }
73
-
74
- public string No
75
- {
76
- get { return _no.ToString(); }
77
- }
78
-
79
-
80
- private ObservableCollection<Item> _items;
81
- public ObservableCollection<Item> Items
82
- {
83
- get { return _items; }
84
- }
85
-
86
- public DelegateCommand AddCommand { get; }
87
-
88
- private void ExecuteAddCommand()
89
- {
90
- _no++;
91
- Item itm = new Item( _xCode, _yCode);
92
- _stack.Push(itm);
93
- _items.Add(itm);
94
- _yCode += 60;
95
- }
96
-
97
- public DelegateCommand DelCommand { get; }
98
-
99
- private void ExecuteDelCommand()
100
- {
101
- if (_no > 0)
102
- {
103
- Item itm = _stack.Pop();
104
- _items.Remove(itm);
105
- _yCode -= 60;
106
- _no--;
107
- }
108
- else
109
- {
110
- MessageBox.Show("これ以上削除できません。");
111
- }
112
- }
113
- }
114
-
115
- public class Item
116
- {
117
- public Item(int x, int y)
118
- {
119
- X = x;
120
- Y = y;
121
- }
122
- public int X { get; set; }
123
- public int Y { get; set; }
124
-
125
- }
126
- ```
127
-
128
54
  [UserControlのXaml]
129
55
  ```Xaml
130
- <UserControl x:Class="ApprovalFlow.Views.ActionPanel"
56
+ <UserControl x:Class="TEST.Views.ActionPanel"
131
57
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
132
58
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
133
59
  xmlns:prism="http://prismlibrary.com/"