Eoin Hennessy
2009-Apr-17 16:51 UTC
[Ironruby-core] Silverlight B3 - Positioning an element within a Canvas
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. -- Posted via http://www.ruby-forum.com/.
Thibaut Barrère
2009-Apr-17 19:37 UTC
[Ironruby-core] Silverlight B3 - Positioning an element within a Canvas
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
Thibaut Barrère
2009-Jun-26 09:07 UTC
[Ironruby-core] Silverlight B3 - Positioning an element within a Canvas
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
Thibaut Barrère
2009-Jun-26 13:30 UTC
[Ironruby-core] Silverlight B3 - Positioning an element within a Canvas
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