support for .NET framework 3.5
Still have bugs
This commit is contained in:
1 parent
5878039e21
commit
7d6b491f25
704 files changed
+48273
-33
No files matched your search
@@ -0,0 +1,42 @@
|
||||
using System.Windows;
|
||||
|
||||
namespace HandyControl.Interactivity
|
||||
{
|
||||
public sealed class BehaviorCollection : AttachableCollection<Behavior>
|
||||
{
|
||||
internal BehaviorCollection()
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnAttached()
|
||||
{
|
||||
foreach (var behavior in this)
|
||||
behavior.Attach(AssociatedObject);
|
||||
}
|
||||
|
||||
protected override void OnDetaching()
|
||||
{
|
||||
foreach (var behavior in this)
|
||||
behavior.Detach();
|
||||
}
|
||||
|
||||
internal override void ItemAdded(Behavior item)
|
||||
{
|
||||
if (AssociatedObject == null)
|
||||
return;
|
||||
item.Attach(AssociatedObject);
|
||||
}
|
||||
|
||||
internal override void ItemRemoved(Behavior item)
|
||||
{
|
||||
if (((IAttachedObject) item).AssociatedObject == null)
|
||||
return;
|
||||
item.Detach();
|
||||
}
|
||||
|
||||
protected override Freezable CreateInstanceCore()
|
||||
{
|
||||
return new BehaviorCollection();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user