[Closed] .NET WPF and MXS Example
I created a Maxscript Example file of an quick and easy way to create full WPF .Net UI’s and tie the event’s back to Maxscript functions. Hope this helps anyone looking to get into it.
Dude! You The Man! :d
Edit:
Not sure if this is caused my minimizing/maximizing max, but when I try to create the Point marker via the Menu at the top, it only works sometimes… :S
Weird, I am not seeing that error. This is just to provide a starting point though, so I wouldn’t expect it to be perfect. (the dotnet.SetLiftimeControl statement needs to be removed to work on max 9 or 2009)
Hope it helps you!
It doesn’t run here
-- Error occurred in anonymous codeblock; filename: D:\_script_Depot\ProductionPipeline\; position: 5146; line: 110
-- Runtime error: dotNet runtime exception: External component has thrown an exception.
Stepping through it only the .show (last line) throws an exception.
Max2010/WinXP 32b
-Johan
Johan – I think you need at least .NET 3.5 installed for it to work and if I remember rightly, 2010 only comes with .NET 3.0
Chad – nice example. I’ve been playing with WPF myself quite a bit recently.
One nice thing to add to your example script would be making the WPF window become a child window of max so that it plays nicely with other max windows, just like using MaxForm.ShowModeless().
To do this, you’ll need to remove the TopMost=“True” in the xaml string and then in the code just before the call to the_window.show() you should put these two lines:
wih = dotnetobject "System.Windows.Interop.WindowInteropHelper" the_window
wih.owner = dotnetobject "System.IntPtr" ( windows.getMAXHWND() )
Well I think that 32 bit just isn’t working at all with WPF. This is going to cause me problems as I never know what my clients are going to be using. WPF is definitely the way to go and will makes lots of what I do easier.
sweet, all these snippets are greatly appreciated. I’ve been learning Blend recently so am looking forward to making some custom WPF user controls.
http://www.microsoft.com/expression/products/blend_overview.aspx
Have not gotten around to it myself.
-Johan
*Hey, didn’t there use to be a free version?
r.e. Blend – Didn’t think there was a free version, maybe a beta release perhaps?
I decided that WPF is worth investing in so I have purchased it. Am slowly working through the new WPF learning curve but am excited about the possibilities for some kick-ass user control interaction for max, all data bound to an XML-based character pipeline.