I use ElementHost to embed WPF controls in C++/Win 32 or MFC
Test with a rotated WPF Button =>
Set :
Common Language Runtime Support (/clr)
Debug Information Format : C7 compatible (/Z7)
Enable C++ Exceptions : No
Basic Runtime Checks : Default
In pch.h :
#using <PresentationFramework.dll>
#using <PresentationCore.dll>
#using <WindowsBase.dll>
#using <System.Windows.Forms.dll>
#using <WindowsFormsIntegration.dll>
#using <System.dll>
#using <System.Drawing.dll>
Test code for the rotated Button :
System::Windows::Controls::Canvas^ canvas = gcnew System::Windows::Controls::Canvas();
System::Windows::Controls::Button^ btn1 = gcnew System::Windows::Controls::Button();
btn1->Content = "Test Button";
btn1->SetValue(System::Windows::Controls::Canvas::LeftProperty, 50.0);
btn1->Width = 200;
btn1->Height = 40;
canvas->Children->Add(btn1);
System::Windows::Media::RotateTransform^ rotateTransform1 = gcnew System::Windows::Media::RotateTransform(45);
btn1->RenderTransform = rotateTransform1;
System::Windows::Forms::Integration::ElementHost^ eh = gcnew System::Windows::Forms::Integration::ElementHost();
eh->Child = canvas;
eh->Location = System::Drawing::Point(100, 100);
eh->Size = System::Drawing::Size(300, 300);
eh->BackgroundImage = gcnew System::Drawing::Bitmap("e:\\blue-floral-background-flower-vector-3286564.jpg");
HWND hWndWrapper = (HWND)eh->Handle.ToPointer();
::SetParent(hWndWrapper, m_hWnd);