Author: spouliot
Date: 2007-12-20 13:00:20 -0500 (Thu, 20 Dec 2007)
New Revision: 91724
Modified:
trunk/moon/src/ChangeLog
trunk/moon/src/geometry.h
trunk/moon/src/xaml.cpp
Log:
2007-12-20 Sebastien Pouliot <[EMAIL PROTECTED]>
* geometry.h: Remove hack for PathGeometry::FiguresProperty
* xaml.cpp: If a collection is null by default then we must call
parent->SetValue(dp, collection) or the collection, and it's
contents, won't be available. Fix (correctly) Chess.
Modified: trunk/moon/src/ChangeLog
===================================================================
--- trunk/moon/src/ChangeLog 2007-12-20 17:48:51 UTC (rev 91723)
+++ trunk/moon/src/ChangeLog 2007-12-20 18:00:20 UTC (rev 91724)
@@ -1,3 +1,10 @@
+2007-12-20 Sebastien Pouliot <[EMAIL PROTECTED]>
+
+ * geometry.h: Remove hack for PathGeometry::FiguresProperty
+ * xaml.cpp: If a collection is null by default then we must call
+ parent->SetValue(dp, collection) or the collection, and it's
+ contents, won't be available. Fix (correctly) Chess.
+
2007-12-19 Sebastien Pouliot <[EMAIL PROTECTED]>
* geometry.cpp: Fix Draw and ComputeBound to deal with the fact that
Modified: trunk/moon/src/geometry.h
===================================================================
--- trunk/moon/src/geometry.h 2007-12-20 17:48:51 UTC (rev 91723)
+++ trunk/moon/src/geometry.h 2007-12-20 18:00:20 UTC (rev 91724)
@@ -160,7 +160,7 @@
public:
static DependencyProperty* FiguresProperty;
- PathGeometry () { SetValue (PathGeometry::FiguresProperty,
Value::CreateUnref (new PathFigureCollection ())); }
+ PathGeometry () {}
virtual Type::Kind GetObjectType () { return Type::PATHGEOMETRY; };
virtual void OnPropertyChanged (DependencyProperty *prop);
Modified: trunk/moon/src/xaml.cpp
===================================================================
--- trunk/moon/src/xaml.cpp 2007-12-20 17:48:51 UTC (rev 91723)
+++ trunk/moon/src/xaml.cpp 2007-12-20 18:00:20 UTC (rev 91724)
@@ -2563,14 +2563,14 @@
inst->element_name = i->name;
inst->element_type = XamlElementInstance::ELEMENT;
+ DependencyProperty *dep = NULL;
+ XamlElementInstance *walk = p->current_element;
+
if (is_instance_of (inst, Type::COLLECTION)) {
// If we are creating a collection, try walking up the element
tree,
// to find the parent that we belong to and using that instance
for
// our collection, instead of creating a new one
- XamlElementInstance *walk = p->current_element;
- DependencyProperty *dep = NULL;
-
// We attempt to advance past the property setter, because we
might be dealing with a
// content element
if (walk && walk->element_type ==
XamlElementInstance::PROPERTY) {
@@ -2587,13 +2587,21 @@
if (dep && dep->value_type == i->dependency_type) {
Value *v = ((DependencyObject * ) walk->item)->GetValue
(dep);
- if (v)
+ if (v) {
inst->item = v->AsCollection ();
+ dep = NULL;
+ }
+ // note: if !v then the default collection is NULL
(e.g. PathFigureCollection)
}
}
if (!inst->item) {
inst->item = i->create_item ();
+
+ // in case we must store the collection into the parent
+ if (dep && dep->value_type == i->dependency_type)
+ ((DependencyObject * ) walk->item)->SetValue (dep, new
Value (inst->item));
+
if (p->loader)
inst->item->SetSurface (p->loader->GetSurface ());
p->AddCreatedElement (inst->item);
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches