Dreamine.UI.Wpf.Controls
1.0.1
Dreamine.UI.Wpf.Controls 사용자 인터페이스 기능과 구성 요소를 제공합니다.
Toggle main menu visibility
로딩중...
검색중...
일치하는것 없음
DreamineCheckSelector.xaml.cs
이 파일의 문서화 페이지로 가기
1
using
System.Windows;
2
using
System.Windows.Controls;
3
using
System.Windows.Input;
4
5
namespace
Dreamine.UI.Wpf.Controls.VsCustomControls
6
{
15
public
partial class
DreamineCheckSelector
: UserControl
16
{
17
// ---------------------------------------------------------------------
18
// \brief Command
19
// ---------------------------------------------------------------------
20
29
public
static
readonly DependencyProperty
CommandProperty
=
30
DependencyProperty.Register(
31
nameof(
Command
),
32
typeof(ICommand),
33
typeof(
DreamineCheckSelector
),
34
new
PropertyMetadata(
null
));
35
44
public
ICommand?
Command
45
{
46
get
=> (ICommand?)GetValue(
CommandProperty
);
47
set
=> SetValue(
CommandProperty
, value);
48
}
49
50
// -- Remembers the last State of the Left/Right radio buttons
59
private
bool
_lastLeftChecked
=
true
;
68
private
bool
_lastRightChecked
=
false
;
69
78
public
event
RoutedEventHandler
ValueChanged
=
null
!;
79
88
public
DreamineCheckSelector
()
89
{
90
InitializeComponent();
91
92
PART_CheckBox.Checked += (s, e) =>
OnCheckedChanged
(
true
);
93
PART_CheckBox.Unchecked += (s, e) =>
OnCheckedChanged
(
false
);
94
95
PART_RadioLeft.Checked += (s, e) => {
RememberRadio
(
true
);
RaiseValueChanged
(); };
96
PART_RadioRight.Checked += (s, e) => {
RememberRadio
(
false
);
RaiseValueChanged
(); };
97
98
PART_AxisMaxBox.LostFocus += (s, e) =>
RaiseValueChanged
();
99
PART_AxisMaxBox.KeyDown += (s, e) => {
if
(((KeyEventArgs)e).Key == Key.Enter)
RaiseValueChanged
(); };
100
}
101
118
private
void
OnCheckedChanged
(
bool
isChecked)
119
{
120
if
(isChecked)
121
{
122
if
(
IsLeftChecked
||
IsRightChecked
)
123
{
124
_lastLeftChecked
=
IsLeftChecked
;
125
_lastRightChecked
=
IsRightChecked
;
126
}
127
else
128
{
129
IsLeftChecked
=
_lastLeftChecked
;
130
IsRightChecked
=
_lastRightChecked
;
131
}
132
}
133
else
134
{
135
_lastLeftChecked
=
IsLeftChecked
;
136
_lastRightChecked
=
IsRightChecked
;
137
138
IsLeftChecked
=
false
;
139
IsRightChecked
=
false
;
140
}
141
RaiseValueChanged
();
142
}
143
160
private
void
RememberRadio
(
bool
left)
161
{
162
_lastLeftChecked
= left;
163
_lastRightChecked
= !left;
164
}
165
174
private
void
RaiseValueChanged
()
175
{
176
// 기존 RoutedEvent
177
ValueChanged
?.Invoke(
this
,
new
RoutedEventArgs());
178
179
// MVVM Command 실행
180
if
(
Command
?.CanExecute(
this
) ==
true
)
181
Command
.Execute(
this
);
182
}
183
184
193
public
static
readonly DependencyProperty
IsCheckedProperty
=
194
DependencyProperty.Register(nameof(
IsChecked
), typeof(
bool
), typeof(
DreamineCheckSelector
),
new
PropertyMetadata(
false
));
195
204
public
bool
IsChecked
205
{
206
get
=> (bool)GetValue(
IsCheckedProperty
);
207
set
=> SetValue(
IsCheckedProperty
, value);
208
}
209
218
public
static
readonly DependencyProperty
IsLeftCheckedProperty
=
219
DependencyProperty.Register(nameof(
IsLeftChecked
), typeof(
bool
), typeof(
DreamineCheckSelector
),
new
PropertyMetadata(
false
));
220
229
public
bool
IsLeftChecked
230
{
231
get
=> (bool)GetValue(
IsLeftCheckedProperty
);
232
set
=> SetValue(
IsLeftCheckedProperty
, value);
233
}
234
243
public
static
readonly DependencyProperty
IsRightCheckedProperty
=
244
DependencyProperty.Register(nameof(
IsRightChecked
), typeof(
bool
), typeof(
DreamineCheckSelector
),
new
PropertyMetadata(
false
));
245
254
public
bool
IsRightChecked
255
{
256
get
=> (bool)GetValue(
IsRightCheckedProperty
);
257
set
=> SetValue(
IsRightCheckedProperty
, value);
258
}
259
268
public
static
readonly DependencyProperty
CheckTextProperty
=
269
DependencyProperty.Register(nameof(
CheckText
), typeof(
string
), typeof(
DreamineCheckSelector
),
new
PropertyMetadata(
"체크"
));
270
279
public
string
CheckText
280
{
281
get
=> (string)GetValue(
CheckTextProperty
);
282
set
=> SetValue(
CheckTextProperty
, value);
283
}
284
293
public
static
readonly DependencyProperty
LeftRadioTextProperty
=
294
DependencyProperty.Register(nameof(
LeftRadioText
), typeof(
string
), typeof(
DreamineCheckSelector
),
new
PropertyMetadata(
"LEFT"
));
295
304
public
string
LeftRadioText
305
{
306
get
=> (string)GetValue(
LeftRadioTextProperty
);
307
set
=> SetValue(
LeftRadioTextProperty
, value);
308
}
309
318
public
static
readonly DependencyProperty
RightRadioTextProperty
=
319
DependencyProperty.Register(nameof(
RightRadioText
), typeof(
string
), typeof(
DreamineCheckSelector
),
new
PropertyMetadata(
"RIGHT"
));
320
329
public
string
RightRadioText
330
{
331
get
=> (string)GetValue(
RightRadioTextProperty
);
332
set
=> SetValue(
RightRadioTextProperty
, value);
333
}
334
343
public
static
readonly DependencyProperty
GroupNameProperty
=
344
DependencyProperty.Register(nameof(
GroupName
), typeof(
string
), typeof(
DreamineCheckSelector
),
new
PropertyMetadata(
"AxisSelectorGroup"
));
345
354
public
string
GroupName
355
{
356
get
=> (string)GetValue(
GroupNameProperty
);
357
set
=> SetValue(
GroupNameProperty
, value);
358
}
359
368
public
static
readonly DependencyProperty
AxisMaxProperty
=
369
DependencyProperty.Register(nameof(
AxisMax
), typeof(
string
), typeof(
DreamineCheckSelector
),
new
PropertyMetadata(
"20"
));
370
379
public
string
AxisMax
380
{
381
get
=> (string)GetValue(
AxisMaxProperty
);
382
set
=> SetValue(
AxisMaxProperty
, value);
383
}
384
}
385
}
Dreamine.UI.Wpf.Controls.VsCustomControls
Definition
DreamineCheckSelector.xaml.cs:6
Dreamine.UI.Wpf.Controls.VsCustomControls.DreamineCheckSelector.IsLeftChecked
bool IsLeftChecked
Definition
DreamineCheckSelector.xaml.cs:230
Dreamine.UI.Wpf.Controls.VsCustomControls.DreamineCheckSelector.CommandProperty
static readonly DependencyProperty CommandProperty
Definition
DreamineCheckSelector.xaml.cs:29
Dreamine.UI.Wpf.Controls.VsCustomControls.DreamineCheckSelector.IsRightCheckedProperty
static readonly DependencyProperty IsRightCheckedProperty
Definition
DreamineCheckSelector.xaml.cs:243
Dreamine.UI.Wpf.Controls.VsCustomControls.DreamineCheckSelector.DreamineCheckSelector
DreamineCheckSelector()
Definition
DreamineCheckSelector.xaml.cs:88
Dreamine.UI.Wpf.Controls.VsCustomControls.DreamineCheckSelector._lastLeftChecked
bool _lastLeftChecked
Definition
DreamineCheckSelector.xaml.cs:59
Dreamine.UI.Wpf.Controls.VsCustomControls.DreamineCheckSelector.RightRadioTextProperty
static readonly DependencyProperty RightRadioTextProperty
Definition
DreamineCheckSelector.xaml.cs:318
Dreamine.UI.Wpf.Controls.VsCustomControls.DreamineCheckSelector.CheckTextProperty
static readonly DependencyProperty CheckTextProperty
Definition
DreamineCheckSelector.xaml.cs:268
Dreamine.UI.Wpf.Controls.VsCustomControls.DreamineCheckSelector.OnCheckedChanged
void OnCheckedChanged(bool isChecked)
Definition
DreamineCheckSelector.xaml.cs:118
Dreamine.UI.Wpf.Controls.VsCustomControls.DreamineCheckSelector.IsCheckedProperty
static readonly DependencyProperty IsCheckedProperty
Definition
DreamineCheckSelector.xaml.cs:193
Dreamine.UI.Wpf.Controls.VsCustomControls.DreamineCheckSelector.RaiseValueChanged
void RaiseValueChanged()
Definition
DreamineCheckSelector.xaml.cs:174
Dreamine.UI.Wpf.Controls.VsCustomControls.DreamineCheckSelector.GroupName
string GroupName
Definition
DreamineCheckSelector.xaml.cs:355
Dreamine.UI.Wpf.Controls.VsCustomControls.DreamineCheckSelector.IsLeftCheckedProperty
static readonly DependencyProperty IsLeftCheckedProperty
Definition
DreamineCheckSelector.xaml.cs:218
Dreamine.UI.Wpf.Controls.VsCustomControls.DreamineCheckSelector.Command
ICommand? Command
Definition
DreamineCheckSelector.xaml.cs:45
Dreamine.UI.Wpf.Controls.VsCustomControls.DreamineCheckSelector.IsRightChecked
bool IsRightChecked
Definition
DreamineCheckSelector.xaml.cs:255
Dreamine.UI.Wpf.Controls.VsCustomControls.DreamineCheckSelector.ValueChanged
RoutedEventHandler ValueChanged
Definition
DreamineCheckSelector.xaml.cs:78
Dreamine.UI.Wpf.Controls.VsCustomControls.DreamineCheckSelector.AxisMaxProperty
static readonly DependencyProperty AxisMaxProperty
Definition
DreamineCheckSelector.xaml.cs:368
Dreamine.UI.Wpf.Controls.VsCustomControls.DreamineCheckSelector.RememberRadio
void RememberRadio(bool left)
Definition
DreamineCheckSelector.xaml.cs:160
Dreamine.UI.Wpf.Controls.VsCustomControls.DreamineCheckSelector.AxisMax
string AxisMax
Definition
DreamineCheckSelector.xaml.cs:380
Dreamine.UI.Wpf.Controls.VsCustomControls.DreamineCheckSelector.IsChecked
bool IsChecked
Definition
DreamineCheckSelector.xaml.cs:205
Dreamine.UI.Wpf.Controls.VsCustomControls.DreamineCheckSelector.RightRadioText
string RightRadioText
Definition
DreamineCheckSelector.xaml.cs:330
Dreamine.UI.Wpf.Controls.VsCustomControls.DreamineCheckSelector.LeftRadioText
string LeftRadioText
Definition
DreamineCheckSelector.xaml.cs:305
Dreamine.UI.Wpf.Controls.VsCustomControls.DreamineCheckSelector.CheckText
string CheckText
Definition
DreamineCheckSelector.xaml.cs:280
Dreamine.UI.Wpf.Controls.VsCustomControls.DreamineCheckSelector.LeftRadioTextProperty
static readonly DependencyProperty LeftRadioTextProperty
Definition
DreamineCheckSelector.xaml.cs:293
Dreamine.UI.Wpf.Controls.VsCustomControls.DreamineCheckSelector.GroupNameProperty
static readonly DependencyProperty GroupNameProperty
Definition
DreamineCheckSelector.xaml.cs:343
Dreamine.UI.Wpf.Controls.VsCustomControls.DreamineCheckSelector._lastRightChecked
bool _lastRightChecked
Definition
DreamineCheckSelector.xaml.cs:68
CheckSelector
DreamineCheckSelector.xaml.cs
다음에 의해 생성됨 :
1.17.0