Skip to content

Instantly share code, notes, and snippets.

@aaronc
Last active December 15, 2015 12:09
Show Gist options
  • Save aaronc/fab70684cb52803a983f to your computer and use it in GitHub Desktop.
Save aaronc/fab70684cb52803a983f to your computer and use it in GitHub Desktop.
Load my-view1.clj and enter at the REPL:
my-view1=> (dev-init #'init-my-view1)
You should see a Window appear with a button.
Pressing F5 will cause the view to reload (including reloading the XAML from the disk).
(ns my-view1
(:use
[ClojureWpf.core])
(:import
[System.Windows MessageBox]))
(defn- on-hello-click [s e]
(MessageBox/Show "You clicked hello"))
(defn init-my-view1 []
(let [view (load-dev-xaml "MyView1.xaml")]
(at [view :btnHello] :Click #'on-hello-click)
view))
<UserControl x:Class="MyView1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Height="650" Width="575">
<Grid>
<Button x:Name="btnHello">Hello World</Button>
</Grid>
</UserControl>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment