I am new to the Windows world and I think I am getting lost in the weeds on the issue. I would like to get advice from people with experience with C ++ / CLI and WPF and XAML.
I have win32 code and I need to run the WPF GUI. I found this MS pass pattern that uses C ++ / CLI . I adapted it for my purposes and it works great.
Then I wanted to tear out WPF programming material and use XAML instead. This means that I can pass the XAML to the designer and get myself out of the UI design cycle, where I certainly don't belong. After reading the WPF Interaction Projects section of WPF and Win32 Interoperation on MSDN , I decided to go with the XamlReader::Load option and load the unbound XAML at runtime. My XAML markup is a Canvas UIElement , which I programmatically add as a child of my C ++ / CLI Grid root element. This works great.
Now I want to add an event handler to the controls in XAML. Here I began to run into problems. I am sure that my total ignorance of the Windows world is 95% of what killed me.
I started with a Rob Relyea page describing the various options for the XAML event handler .
I decided to try compiling XAML as a C # DLL. This is basically the same XAML as with boot. I instantiate the object and programmatically add it as a child, as before. But ... I get only a black window. Do not throw any exceptions. I am puzzled.
My question is: have I even taken the right path? On the XAML event-event handlers page, you can use the event handlers defined in uncompiled XAML in the .NET Framework 4. Should I bite a bullet and just upgrade to VS 2010 (now I am on VS 2008), so I can use .Net Framework 4 and just stick with unrelated XAML? Are there any problems with such matters?
Or, if you think the compiled C # DLL is the smart way, do you have any ideas on how I can debug the problems that I am having?
Or is there a better and completely different approach?
Thanks in advance for your advice.
ass
event-handling wpf xaml c ++ - cli
Polly
source share