I installed the Developer runtime, which incidentally is LinkID=150227 for Mac. 
 In any case, I got my Converter recognized as a .NET type; however I couldn't 
get passed the AG_E_PARSER_BAD_TYPE error when loading the converter reference 
in XAML. I initially thought there may be some namespace issue, but I can see 
the Converter is reflecting it's correct namespace, and the XML namespace seems 
to match too.  I tried importing my converted in App.py before the XAML is 
loaded to see if that would put it in scope, but that didn't work either.  I'm 
not sure what to try next?  Anyone have any ideas?


On Jan 20, 2010, at 3:12 AM, Jimmy Schementi wrote:

>> I took a simple converter and ported it to IronPython, however 
>> I'm getting the ever helpful SystemError 2255. 
> 
> Do you have the Silverlight "Developer" runtime? The "Consumer" runtime give 
> you only error codes, while the developer runtime gives you actual exception 
> messages. Here's the developer runtime:
> http://go.microsoft.com/fwlink/?LinkID=150228
> 
>> I can manually import my converter class via the REPL, and do a dir on it 
>> too.
>>  Which leads me to believe there's another issue I'm unaware of.  
>> Perhaps it's not supported?  Has anyone else tried implementing a 
>> converter in IronPython yet?
> 
> IValueConverter is an interface that allows you to make custom data 
> conversions that happen during data binding in XAML: 
> http://msdn.microsoft.com/en-us/library/system.windows.data.ivalueconverter(VS.95).aspx.
>  However, IronPython doesn't directly support data binding in Silverlight, 
> since Python classes are not 1-to-1 with CLR classes. The XAML required to 
> hook up a converter (Converter={StaticResource FormatConverter}) won't be 
> able to find a FormatConverter class defined in IronPython either, since the 
> name is auto-generated. So, you'll be able to interact with your Python 
> classes from the REPL, but they will fail to be used in XAML (if you use the 
> developer runtime you'll probably see an error in the XAML parser ... which 
> unfortunately also gives cryptic error msgs =P)
> 
> There are two ways to wire this up: 
> 
> (1) Use clrtype.py to control the CLR type, properties, etc, that the 
> IronPython class generates. Lukáš Čenovský recently showed that you can do 
> data-binding with this in Silverlight: 
> http://gui-at.blogspot.com/2009/11/inotifypropertychanged-and-databinding.html
> 
> (2) Have anything your XAML needs to reference as a C# stub (defining all 
> things requiring static references, including properties and methods), which 
> your Python class inherits from and defines the actual behavior.
> 
> I suggest #1 as it's a more elegant solution, but #2 will work as a good 
> safety net if you encounter something that doesn't work in #1.
> 
> ~Jimmy
_______________________________________________
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to