Skip to content

Instantly share code, notes, and snippets.

@Ball
Created August 22, 2009 16:07
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Ball/172828 to your computer and use it in GitHub Desktop.
Save Ball/172828 to your computer and use it in GitHub Desktop.
Binding Example
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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment