[Python.NET] Can a python class passed back to .Net

Hansong Huang hhspiny at pine.cc
Wed Mar 16 17:29:15 EDT 2016


This might be an obvious problem out of my lack of understanding how
Python.Net work.

I am exploring the possibility of program WPF ViewModel.

After resolving the problem inheriting .Net interface class,

class ViewModel(System.ComponentModel.INotifyPropertyChanged):
    __namespace__ = "WPFPy"
....

class MyViewModel(ViewModel):
....  here to implement follow ironpython examples

then assign it to DataContext

self.window = System.Windows.Markup.XamlReader.Load(outStream)
self.window.DataContext = MyViewModel()

this does not seem to work, the property/method in MyViewModel is never
called nor any data binding happened.

I was able to get ExpandoObject work well though and binding works fine
self.window.DataContext = System.Dynamic.ExpandoObject()

so, that makes me asking if it makes sense at all to pass a Python class
object back into .Net framework and expect it works -- even if the proper
interface is implemented.


thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pythondotnet/attachments/20160316/76b5a704/attachment.html>


More information about the PythonDotNet mailing list