[IronPython] using XAML in IronPython

Andrew Evans evans.d.andrew at gmail.com
Sat Jul 10 00:23:01 CEST 2010


ahh yes that's right I was using the development environment you linked.
Thanks for the insight into my issue makes sense now

On Fri, Jul 9, 2010 at 3:14 PM, Andrew Evans <evans.d.andrew at gmail.com>wrote:

> Hello I am learning IronPython having come from a CPython background, I
> started learning C# to add more to my knowledge base for IronPython.
>
> I have a few questions using XAML:
>
> First if I build something using the xaml designer in IronPython Studio and
> give it a name x:name="somename" and want to reference it in a function def
> doSomething(s, e): how do I reference the item with the x:name value do I
> just type somename = changePropertyofControl? and how do I call the
> function?
>
> XAML
>
> <Window
>        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
>        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
>        Title="Hello World" Height="300" Width="300">
>        <Button x:Name="hello">Click Me</Button>
> </Window>
>
> Python Code is where I am confused
>
> import clr
> clr.AddReference('PresentationFramework')
>
> from System.Windows.Markup import XamlReader
> from System.Windows import Application
> from System.IO import FileStream, FileMode
>
> app = Application()
>
> def doSomething(sender,event):
>     hello.Content = "Try again"
>
>
> app.Run(XamlReader.Load(FileStream('Hello_World.xaml', FileMode.Open)))
>
> This I am sure is really simple... Coming from a Tk background its
> confusing for me.
>
> Anyway ty
>
> Cheers
>
> Andrew
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20100709/a0be0851/attachment.html>


More information about the Ironpython-users mailing list