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,46 @@
|
||||
using System;
|
||||
using System.Windows;
|
||||
|
||||
namespace HandyControl.Interactivity
|
||||
{
|
||||
public class TriggerActionCollection : AttachableCollection<TriggerAction>
|
||||
{
|
||||
internal TriggerActionCollection()
|
||||
{
|
||||
}
|
||||
|
||||
protected override Freezable CreateInstanceCore()
|
||||
{
|
||||
return new TriggerActionCollection();
|
||||
}
|
||||
|
||||
internal override void ItemAdded(TriggerAction item)
|
||||
{
|
||||
if (item.IsHosted)
|
||||
throw new InvalidOperationException(ExceptionStringTable
|
||||
.CannotHostTriggerActionMultipleTimesExceptionMessage);
|
||||
if (AssociatedObject != null)
|
||||
item.Attach(AssociatedObject);
|
||||
item.IsHosted = true;
|
||||
}
|
||||
|
||||
internal override void ItemRemoved(TriggerAction item)
|
||||
{
|
||||
if (((IAttachedObject) item).AssociatedObject != null)
|
||||
item.Detach();
|
||||
item.IsHosted = false;
|
||||
}
|
||||
|
||||
protected override void OnAttached()
|
||||
{
|
||||
foreach (var action in this)
|
||||
action.Attach(AssociatedObject);
|
||||
}
|
||||
|
||||
protected override void OnDetaching()
|
||||
{
|
||||
foreach (var action in this)
|
||||
action.Detach();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user