Dreamine.UI.Wpf.Controls
1.0.1
Dreamine.UI.Wpf.Controls 사용자 인터페이스 기능과 구성 요소를 제공합니다.
Toggle main menu visibility
로딩중...
검색중...
일치하는것 없음
DreamineExpander.cs
이 파일의 문서화 페이지로 가기
1
using
System.Windows;
2
using
System.Windows.Controls;
3
using
System.Windows.Input;
4
using
System.Windows.Media;
5
6
namespace
Dreamine.UI.Wpf.Controls
7
{
16
public
class
DreamineExpander
: HeaderedContentControl
17
{
26
static
DreamineExpander
()
27
{
28
DefaultStyleKeyProperty.OverrideMetadata(typeof(
DreamineExpander
),
29
new
FrameworkPropertyMetadata(typeof(
DreamineExpander
)));
30
31
var uri =
new
Uri(
"/Dreamine.UI.Wpf.Themes;component/DreamineExpanderStyle.xaml"
, UriKind.RelativeOrAbsolute);
32
33
if
(Application.Current !=
null
)
34
{
35
bool
alreadyAdded = Application.Current.Resources.MergedDictionaries
36
.OfType<ResourceDictionary>()
37
.Any(x => x.Source !=
null
&& x.Source.Equals(uri));
38
39
if
(!alreadyAdded)
40
{
41
var dict =
new
ResourceDictionary { Source = uri };
42
Application.Current.Resources.MergedDictionaries.Add(dict);
43
}
44
}
45
}
46
55
public
bool
IsExpanded
56
{
57
get
=> (bool)GetValue(
IsExpandedProperty
);
58
set
=> SetValue(
IsExpandedProperty
, value);
59
}
60
69
public
static
readonly DependencyProperty
IsExpandedProperty
=
70
DependencyProperty.Register(nameof(
IsExpanded
), typeof(
bool
), typeof(
DreamineExpander
),
71
new
FrameworkPropertyMetadata(
true
, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault,
OnIsExpandedChanged
));
72
105
private
static
void
OnIsExpandedChanged
(DependencyObject d, DependencyPropertyChangedEventArgs e)
106
{
107
if
(d is
DreamineExpander
expander)
108
{
109
if
(expander.ExpandChangedCommand?.CanExecute(
null
) ==
true
)
110
{
111
expander.ExpandChangedCommand.Execute(
null
);
112
}
113
else
114
{
115
if
((
bool
)expander.ShowExpandIcon ==
false
&& (
bool
)e.NewValue ==
false
)
116
expander.IsExpanded =
true
;
117
}
118
}
119
}
120
129
public
ICommand
ExpandChangedCommand
130
{
131
get
=> (ICommand)GetValue(
ExpandChangedCommandProperty
);
132
set
=> SetValue(
ExpandChangedCommandProperty
, value);
133
}
134
143
public
static
readonly DependencyProperty
ExpandChangedCommandProperty
=
144
DependencyProperty.Register(nameof(
ExpandChangedCommand
), typeof(ICommand), typeof(
DreamineExpander
));
145
154
public
bool
UseExpandAnimation
155
{
156
get
=> (bool)GetValue(
UseExpandAnimationProperty
);
157
set
=> SetValue(
UseExpandAnimationProperty
, value);
158
}
159
168
public
static
readonly DependencyProperty
UseExpandAnimationProperty
=
169
DependencyProperty.Register(nameof(
UseExpandAnimation
), typeof(
bool
), typeof(
DreamineExpander
),
new
PropertyMetadata(
true
));
170
179
public
ExpanderArrowPlacement
ArrowPlacement
180
{
181
get
=> (
ExpanderArrowPlacement
)GetValue(
ArrowPlacementProperty
);
182
set
=> SetValue(
ArrowPlacementProperty
, value);
183
}
184
193
public
static
readonly DependencyProperty
ArrowPlacementProperty
=
194
DependencyProperty.Register(nameof(
ArrowPlacement
), typeof(
ExpanderArrowPlacement
), typeof(
DreamineExpander
),
195
new
PropertyMetadata(
ExpanderArrowPlacement
.Left));
196
205
public
double
HeaderFontSize
206
{
207
get
{
return
(
double
)GetValue(
HeaderFontSizeProperty
); }
208
set
{ SetValue(
HeaderFontSizeProperty
, value); }
209
}
210
219
public
static
readonly DependencyProperty
HeaderFontSizeProperty
=
220
DependencyProperty.Register(
"HeaderFontSize"
, typeof(
double
), typeof(
DreamineExpander
),
new
PropertyMetadata(SystemFonts.MessageFontSize));
221
230
public
FontWeight
HeaderFontWeight
231
{
232
get
{
return
(FontWeight)GetValue(
HeaderFontWeightProperty
); }
233
set
{ SetValue(
HeaderFontWeightProperty
, value); }
234
}
235
244
public
static
readonly DependencyProperty
HeaderFontWeightProperty
=
245
DependencyProperty.Register(
"HeaderFontWeight"
, typeof(FontWeight), typeof(
DreamineExpander
),
new
PropertyMetadata(FontWeights.Normal));
246
255
public
Brush
HeaderForeground
256
{
257
get
{
return
(Brush)GetValue(
HeaderForegroundProperty
); }
258
set
{ SetValue(
HeaderForegroundProperty
, value); }
259
}
260
269
public
static
readonly DependencyProperty
HeaderForegroundProperty
=
270
DependencyProperty.Register(
"HeaderForeground"
, typeof(Brush), typeof(
DreamineExpander
),
new
PropertyMetadata(SystemColors.ControlTextBrush));
271
280
public
bool
ShowExpandIcon
281
{
282
get
=> (bool)GetValue(
ShowExpandIconProperty
);
283
set
=> SetValue(
ShowExpandIconProperty
, value);
284
}
285
294
public
static
readonly DependencyProperty
ShowExpandIconProperty
=
295
DependencyProperty.Register(nameof(
ShowExpandIcon
), typeof(
bool
), typeof(
DreamineExpander
),
296
new
PropertyMetadata(
true
));
297
}
298
307
public
enum
ExpanderArrowPlacement
308
{
317
Left
,
318
327
Right
328
}
329
}
Dreamine.UI.Wpf.Controls
Definition
DreamineCheckSelector.xaml.cs:6
Dreamine.UI.Wpf.Controls.ExpanderArrowPlacement
ExpanderArrowPlacement
Definition
DreamineExpander.cs:308
Dreamine.UI.Wpf.Controls.IconPosition.Right
@ Right
Definition
DreamineButton.cs:85
Dreamine.UI.Wpf.Controls.IconPosition.Left
@ Left
Definition
DreamineButton.cs:76
Dreamine.UI.Wpf.Controls.DreamineExpander.ExpandChangedCommandProperty
static readonly DependencyProperty ExpandChangedCommandProperty
Definition
DreamineExpander.cs:143
Dreamine.UI.Wpf.Controls.DreamineExpander.OnIsExpandedChanged
static void OnIsExpandedChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
Definition
DreamineExpander.cs:105
Dreamine.UI.Wpf.Controls.DreamineExpander.HeaderFontWeight
FontWeight HeaderFontWeight
Definition
DreamineExpander.cs:231
Dreamine.UI.Wpf.Controls.DreamineExpander.UseExpandAnimationProperty
static readonly DependencyProperty UseExpandAnimationProperty
Definition
DreamineExpander.cs:168
Dreamine.UI.Wpf.Controls.DreamineExpander.DreamineExpander
static DreamineExpander()
Definition
DreamineExpander.cs:26
Dreamine.UI.Wpf.Controls.DreamineExpander.IsExpandedProperty
static readonly DependencyProperty IsExpandedProperty
Definition
DreamineExpander.cs:69
Dreamine.UI.Wpf.Controls.DreamineExpander.HeaderFontSize
double HeaderFontSize
Definition
DreamineExpander.cs:206
Dreamine.UI.Wpf.Controls.DreamineExpander.ArrowPlacementProperty
static readonly DependencyProperty ArrowPlacementProperty
Definition
DreamineExpander.cs:193
Dreamine.UI.Wpf.Controls.DreamineExpander.ExpandChangedCommand
ICommand ExpandChangedCommand
Definition
DreamineExpander.cs:130
Dreamine.UI.Wpf.Controls.DreamineExpander.HeaderFontWeightProperty
static readonly DependencyProperty HeaderFontWeightProperty
Definition
DreamineExpander.cs:244
Dreamine.UI.Wpf.Controls.DreamineExpander.IsExpanded
bool IsExpanded
Definition
DreamineExpander.cs:56
Dreamine.UI.Wpf.Controls.DreamineExpander.UseExpandAnimation
bool UseExpandAnimation
Definition
DreamineExpander.cs:155
Dreamine.UI.Wpf.Controls.DreamineExpander.HeaderFontSizeProperty
static readonly DependencyProperty HeaderFontSizeProperty
Definition
DreamineExpander.cs:219
Dreamine.UI.Wpf.Controls.DreamineExpander.HeaderForeground
Brush HeaderForeground
Definition
DreamineExpander.cs:256
Dreamine.UI.Wpf.Controls.DreamineExpander.ShowExpandIconProperty
static readonly DependencyProperty ShowExpandIconProperty
Definition
DreamineExpander.cs:294
Dreamine.UI.Wpf.Controls.DreamineExpander.ArrowPlacement
ExpanderArrowPlacement ArrowPlacement
Definition
DreamineExpander.cs:180
Dreamine.UI.Wpf.Controls.DreamineExpander.ShowExpandIcon
bool ShowExpandIcon
Definition
DreamineExpander.cs:281
Dreamine.UI.Wpf.Controls.DreamineExpander.HeaderForegroundProperty
static readonly DependencyProperty HeaderForegroundProperty
Definition
DreamineExpander.cs:269
Controls
DreamineExpander.cs
다음에 의해 생성됨 :
1.17.0