Skip to content

Instantly share code, notes, and snippets.

@jacksonh
Created September 1, 2010 15:49
Show Gist options
  • Select an option

  • Save jacksonh/560896 to your computer and use it in GitHub Desktop.

Select an option

Save jacksonh/560896 to your computer and use it in GitHub Desktop.
diff --git a/class/System.Windows/Mono.Xaml/MarkupExpressionParser.cs b/class/System.Windows/Mono.Xaml/MarkupExpressionParser.cs
index e25f2dd..e73464b 100644
--- a/class/System.Windows/Mono.Xaml/MarkupExpressionParser.cs
+++ b/class/System.Windows/Mono.Xaml/MarkupExpressionParser.cs
@@ -77,7 +77,29 @@ namespace Mono.Xaml {
protected override PropertyPath ParsePropertyPath (string piece)
{
- return new PropertyPath (piece);
+ Kind k = Deployment.Current.Types.TypeToKind (typeof (PropertyPath));
+
+ bool v_set;
+ IntPtr unmanaged_value;
+ try {
+ if (!NativeMethods.xaml_value_from_str_with_parser (parser, k, AttributeName, piece, out unmanaged_value, out v_set) || !v_set) {
+ Console.Error.WriteLine ("Unable to parse property path: '{0}'", piece);
+ return null;
+ }
+
+ object obj_value = Value.ToObject (typeof (PropertyPath), unmanaged_value);
+ PropertyPath path = obj_value as PropertyPath;
+
+ if (path != null)
+ return path;
+
+ Console.Error.WriteLine ("Unable to convert property path value: '{0}'", piece);
+ } finally {
+ if (unmanaged_value != IntPtr.Zero)
+ Mono.NativeMethods.value_delete_value2 (unmanaged_value);
+ }
+
+ return null;
}
}
diff --git a/class/tuning/SecurityAttributes/automatic/System.Windows.auto.sc b/class/tuning/SecurityAttributes/automatic/System.Windows.auto.sc
index 97a4005..19d8992 100644
--- a/class/tuning/SecurityAttributes/automatic/System.Windows.auto.sc
+++ b/class/tuning/SecurityAttributes/automatic/System.Windows.auto.sc
@@ -1,5 +1,5 @@
# [SecurityCritical] needed to execute code inside 'System.Windows, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e'.
-# 539 methods needs to be decorated.
+# 540 methods needs to be decorated.
# p/invoke declaration
+SC-M: Mono.Kind Mono.NativeMethods::collection_get_element_type(System.IntPtr)
@@ -202,6 +202,9 @@
# p/invoke declaration
+SC-M: System.Boolean Mono.NativeMethods::xaml_is_property_set(System.IntPtr,System.IntPtr,System.String)
+# p/invoke declaration
++SC-M: System.Boolean Mono.NativeMethods::xaml_value_from_str_with_parser(System.IntPtr,Mono.Kind,System.String,System.String,System.IntPtr&,System.Boolean&)
+
# using 'Mono.Xaml.XamlCallbackData*' as a parameter type
+SC-M: System.Boolean Mono.Xaml.AddChildCallback::Invoke(Mono.Xaml.XamlCallbackData*,Mono.Value*,System.Boolean,System.String,Mono.Value*,System.IntPtr,Mono.Value*,System.IntPtr,Mono.MoonError&)
diff --git a/src/xaml.cpp b/src/xaml.cpp
index b1fb415..814e087 100644
--- a/src/xaml.cpp
+++ b/src/xaml.cpp
@@ -3626,6 +3626,12 @@ xaml_bool_from_str (const char *s, bool *res)
return true;
}
+bool
+xaml_value_from_str_with_parser (gpointer p, Type::Kind type, const char *prop_name, const char *str, Value **v, bool *v_set)
+{
+ return value_from_str_with_parser ((XamlParserInfo *) p, type, prop_name, str, v, v_set);
+}
+
static bool
value_from_str_with_parser (XamlParserInfo *p, Type::Kind type, const char *prop_name, const char *str, Value **v, bool *v_set)
{
diff --git a/src/xaml.h b/src/xaml.h
index 5d89cc0..e625bc3 100644
--- a/src/xaml.h
+++ b/src/xaml.h
@@ -113,6 +113,9 @@ bool time_span_from_str (const char *str, TimeSpan *res);
bool value_from_str_with_typename (const char *type_name, const char *prop_name, const char *str, /* @MarshalAs=IntPtr,IsOut */ Value **v);
/* @GeneratePInvoke */
/* Managed code must call value_free_value on the result */
+bool xaml_value_from_str_with_parser (gpointer *p, Type::Kind type, const char *prop_name, const char *str, /* @MarshalAs=IntPtr,IsOut */ Value **v, bool *v_set);
+/* @GeneratePInvoke */
+/* Managed code must call value_free_value on the result */
bool value_from_str (Type::Kind type, const char *prop_name, const char *str, /* @MarshalAs=IntPtr,IsOut */ Value **v);
bool convert_property_value_to_enum_str (DependencyProperty *prop, Value *v, const char **s);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment