Hi there,
I have a very simple hello-world type IronRuby+Silverlight application
based on the AGDLR samples. It consists of a Canvas containing a single
Rectangle. I am attempting to position the Rectangle within the Canvas
as follows:
layout_root.rect.set_value(Canvas.TopProperty, 0.0)
However, this is leading to the following exception:
MethodAccessException:
System.Windows.DependencyObject.SetValue(System.Windows.DependencyProperty,
Double)
MethodAccessException
at System.Reflection.MethodBase.PerformSecurityCheck(Object obj,
RuntimeMethodHandle method, IntPtr parent, UInt32 invocationFlags)
...
The full trace is at:
http://gist.github.com/97116
What is the preferred method of positioning an element at a Point within
a Canvas?
Thanks.
on 2009-04-17 18:51
on 2009-04-17 21:38
Hi,
> layout_root.rect.set_value(Canvas.TopProperty, 0.0)
I've been experimenting the same error a couple of weeks ago. I'm not
sure why these specific property types calls fail.
I'd love to have a solution for that, or at least a workaround.
-- Thibaut
on 2009-04-17 22:09
I can successfully make the SetValue call from a C# assembly. So I've gotten around the issue by adding a set_position helper to FrameworkElement that calls into a C# helper assembly. Pretty ugly. On Fri, Apr 17, 2009 at 12:37 PM, Thibaut Barrère <thibaut.barrere@gmail.com
on 2009-06-26 11:43
Hi, the issue reported by Eoin a while back is still happening (http://gist.github.com/97116). If you call this from Silverlight: layout_root.rect.set_value(Canvas.TopProperty, 0.0) you'll get: MethodAccessException: System.Windows.DependencyObject.SetValue(System.Windows.DependencyProperty, Double) Is there a work-around allowing to set Canvas.TopProperty and other "static properties" that would currently work, apart from creating a C# wrapper ? I went through existing issues in codeplex but it doesn't seem like it's already registered. I can create an issue if it's a bug. thoughts ? -- Thibaut
on 2009-06-26 15:31
Hi,
> layout_root.rect.set_value(Canvas.TopProperty, 0.0)
not sure if this syntax is supposed to work or not, as I'm just
getting into "attached properties".
But the following syntax works instead, if someone is trying to achieve
this:
Canvas.SetTop(text_block, 200)
hth,
-- Thibaut
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.