Example #1
0
// XXX this was (mostly, except for the type check) c&p from DependencyObjectCollection
void
ResourceDictionary::RemovedFromCollection (Value *value, bool is_value_safe)
{
	if (is_value_safe & value->Is (GetDeployment (), Type::DEPENDENCY_OBJECT)) {
		DependencyObject *obj = value->AsDependencyObject ();

		if (obj) {
			obj->RemovePropertyChangeListener (this);
			obj->RemoveParent (this, NULL);
			obj->SetIsAttached (false);
		}
	}

	Collection::RemovedFromCollection (value, is_value_safe);

	if (is_value_safe && value->Is (GetDeployment (), Type::DEPENDENCY_OBJECT)) {
		if (!from_resource_dictionary_api && value->AsDependencyObject()) {
			g_hash_table_foreach_remove (hash, remove_from_hash_by_value, value->AsDependencyObject ());

			// FIXME we need to EmitChanged something here so the managed RD can remain in sync
		}
	}
}