Dreamine.MVVM.Behaviors.Wpf
1.0.5
Dreamine.MVVM.Behaviors.Wpf 산업 자동화 및 I/O 기능을 제공합니다.
Toggle main menu visibility
로딩중...
검색중...
일치하는것 없음
Interaction.cs
이 파일의 문서화 페이지로 가기
1
using
Dreamine.MVVM.Behaviors.Core.Interfaces;
2
using
System;
3
using
System.Windows;
4
5
namespace
Dreamine.MVVM.Behaviors.Wpf.Interactivity
6
{
15
public
static
class
Interaction
16
{
25
public
static
readonly DependencyProperty
BehaviorsProperty
=
26
DependencyProperty.RegisterAttached(
27
"Behaviors"
,
28
typeof(
BehaviorCollection
),
29
typeof(
Interaction
),
30
new
FrameworkPropertyMetadata(
null
,
OnBehaviorsChanged
));
31
56
public
static
BehaviorCollection
GetBehaviors
(DependencyObject obj)
57
{
58
ArgumentNullException.ThrowIfNull(obj);
59
60
BehaviorCollection
? collection =
61
(
BehaviorCollection
?)obj.GetValue(
BehaviorsProperty
);
62
63
if
(collection is not
null
)
64
{
65
return
collection;
66
}
67
68
collection =
new
BehaviorCollection
();
69
obj.SetValue(
BehaviorsProperty
, collection);
70
71
return
collection;
72
}
73
98
public
static
void
SetBehaviors
(DependencyObject obj,
BehaviorCollection
? value)
99
{
100
ArgumentNullException.ThrowIfNull(obj);
101
obj.SetValue(
BehaviorsProperty
, value);
102
}
103
128
private
static
void
OnBehaviorsChanged
(
129
DependencyObject obj,
130
DependencyPropertyChangedEventArgs args)
131
{
132
BehaviorCollection
? oldCollection = (
BehaviorCollection
?)args.OldValue;
133
BehaviorCollection
? newCollection = (
BehaviorCollection
?)args.NewValue;
134
135
if
(ReferenceEquals(oldCollection, newCollection))
136
{
137
return
;
138
}
139
140
if
(oldCollection is not
null
&&
141
((IAttachedObject)oldCollection).AssociatedObject is not
null
)
142
{
143
oldCollection.
Detach
();
144
}
145
146
if
(newCollection is not
null
)
147
{
148
newCollection.
Attach
(obj);
149
}
150
}
151
}
152
}
Dreamine.MVVM.Behaviors.Wpf.Interactivity
Definition
BehaviorCollection.cs:8
Dreamine.MVVM.Behaviors.Wpf.Interactivity.BehaviorCollection
Definition
BehaviorCollection.cs:18
Dreamine.MVVM.Behaviors.Wpf.Interactivity.BehaviorCollection.Detach
void Detach()
Definition
BehaviorCollection.cs:91
Dreamine.MVVM.Behaviors.Wpf.Interactivity.BehaviorCollection.Attach
void Attach(DependencyObject associatedObject)
Definition
BehaviorCollection.cs:62
Dreamine.MVVM.Behaviors.Wpf.Interactivity.Interaction
Definition
Interaction.cs:16
Dreamine.MVVM.Behaviors.Wpf.Interactivity.Interaction.OnBehaviorsChanged
static void OnBehaviorsChanged(DependencyObject obj, DependencyPropertyChangedEventArgs args)
Definition
Interaction.cs:128
Dreamine.MVVM.Behaviors.Wpf.Interactivity.Interaction.GetBehaviors
static BehaviorCollection GetBehaviors(DependencyObject obj)
Definition
Interaction.cs:56
Dreamine.MVVM.Behaviors.Wpf.Interactivity.Interaction.SetBehaviors
static void SetBehaviors(DependencyObject obj, BehaviorCollection? value)
Definition
Interaction.cs:98
Dreamine.MVVM.Behaviors.Wpf.Interactivity.Interaction.BehaviorsProperty
static readonly DependencyProperty BehaviorsProperty
Definition
Interaction.cs:25
Interactivity
Interaction.cs
다음에 의해 생성됨 :
1.17.0