public
Last active

Binding Example

  • Download Gist
bind_example.rb
Ruby
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
require 'xamltools.rb'
require 'PresentationFramework'
 
class ViewModel
attr :greeting, true
def initialize(greet)
@greeting = greet
end
end
 
view = XamlTools::Xaml.window(:Width => 450, :SizeToContent => :Height) do |w|
w.TextBlock(:FontSize => 48, :HorizontalAlignment=> :Center, :Text => "{Binding Path=greeting}")
end
 
view.data_context = ViewModel.new( "I'm Bound!" )
 
System::Windows::Application.new.run(view)

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.