[Ironruby-core] Finding the mythical root_visual object in Gestalt

Adam Burmister adam.burmister at gmail.com
Wed Nov 25 09:12:03 EST 2009


Hi all,

I'm currently writing about Gestalt using the 1.0 release. The best documentation I can find for it is the PDF "sl-back-to-just-text.pdf", by Jimmy, which states:

"XAML accessors
root_visual maps to System.Windows.Application.Current.RootVisual ... When a method is called that does not exist on root_visual, then FindName(methodName) is called. This allows access to any XAML elements with an x:Name value...

root_visual.Message.Text = "New Message"
"

This is the code that I'm using to try and experiment with this:

<html>
<head>
	<script src="http://visitmix.com/dlr/dlr.js" type="text/javascript"></script>
</head>
<body>

<script type="application/xml+xaml" width="200" height="50">
  <UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Width="200" Height="50">
    <Button x:Name="button1" Content="Button Text" />
  </UserControl>
</script>

<script type="text/ruby">
window.alert root_visual.button1.content
</script>

</body>
</html>

I cannot find this object placed anywhere I would expect; at least it's not as easily available as the documentation leads me to believe.

Can anyone throw some light onto what I'm doing wrong, or if there has been a change in the way this works?

Thank you kindly,
Adam Burmister

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20091125/ec754c8c/attachment.html>


More information about the Ironruby-core mailing list