Hi,

I'm trying to bind an IronRuby object to Silverlight but I can't get it
working. Am I doing something wrong?

My object is:
class Country
  attr_accessor :name, :capital_city
  def initialize(name, capital_city)
    self.name = name
    self.capital_city = capital_city
  end
end

and this is the code that does the binding:
united_states = Country.new("USA", "Washington D.C")
@root.find_name("name_display").data_context = united_states

The XAML file looks as follows:
<UserControl x:Class="System.Windows.Controls.UserControl"
    xmlns="http://schemas.microsoft.com/client/2007";
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml";>
<StackPanel>
  <TextBlock>Country name:</TextBlock>
  <TextBlock x:Name="name_display" Text="{Binding name}"/>
  <TextBlock>Capital city:</TextBlock>
  <TextBlock Text="{Binding capital_city}"/>
</StackPanel>
</UserControl>

Any thoughts?

Thanks!
Shay.
-----------------
Shay Friedman
Author of "IronRuby Unleashed"
http://www.ironshay.com
Follow me: http://twitter.com/ironshay
_______________________________________________
Ironruby-core mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ironruby-core

Reply via email to