Created
August 22, 2009 16:07
-
-
Save Ball/172828 to your computer and use it in GitHub Desktop.
Binding Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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