[Ironpython-users] problem incorporating namespace into Xaml

Slide slide.o.mix at gmail.com
Fri Jul 25 01:54:08 CEST 2014


Just so you are aware FePy was the name of a side project that was a set of
enhancements to IronPython. If you are looking for a shorter form of
IronPython, IP is generally the best way to go so there is no confusion.


On Thu, Jul 24, 2014 at 4:45 PM, John Trinder <TrinderJohn at dsl.pipex.com>
wrote:

>  I'm new to FePy and after doing a fair bit of studying am embarking on
> transcoding a C# project to FePy. I'm encountering a problem incorporating
> a module that defines a subclass of Canvas and then trying to utilize this
> custom canvas in the Xaml code.
>
> My skeleton files/modules and contents are as follows:
>
>
>
> *module1.py *import clr
> clr.AddReference('PresentationFramework')
> import System.Windows.Controls as swc
>
> class CustomCanvas(swc.Canvas):
>     def __init__(self):
>         pass
>
> *WpfApplication1.xaml*
>
> <Window
>        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
> <http://schemas.microsoft.com/winfx/2006/xaml/presentation>
>        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
> <http://schemas.microsoft.com/winfx/2006/xaml>
>        *xmlns:local="clr-namespace:module1"*
>        Title="WpfApplication1" Height="300" Width="300">
>        <Grid>
>             *<local:CustomCanvas HorizontalAlignment="Left" Height="100"
> Margin="96,90,0,0" VerticalAlignment="Top" Width="100"/>*
>        </Grid>
> </Window>
>
> *WpfApplication1.py*
>
> import wpf
>
> from System.Windows import Application, Window
>
> class MyWindow(Window):
>     def __init__(self):
>         wpf.LoadComponent(self, 'WpfApplication1.xaml')
>
> Application().Run(MyWindow())
>
>
> I've marked in bold where I have incorporated my module/namespace.
> Intellisense says that on the *<local:CustomCanvas .../>* line,
> CustomCanvas 'does not exist in the namespace *"clr-namespace:module1"'*
> I'm guessing that it's not possible to do (yet) what I want to do - which
> is pretty basic.
> Thanks in advance btw for any advice and tips.
>
> _______________________________________________
> Ironpython-users mailing list
> Ironpython-users at python.org
> https://mail.python.org/mailman/listinfo/ironpython-users
>
>


-- 
Website: http://earl-of-code.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20140724/a4b10614/attachment.html>


More information about the Ironpython-users mailing list