r/windowsdev • • Apr 17 '16

Visual C++ UWP: add Image to screen from cpp

Now in C#, for better usage of the UWP environment. This is now obsolete.

I want to add an image to the screen at a given location within the C++ code, not the XAML. So, when the user clicks a button, the image is created and shown. It has to be created on the spot.

//
// MainPage.xaml.cpp
// Implementation of the MainPage class.
//

#include "pch.h"
#include "MainPage.xaml.h"

using namespace Audi;

using namespace Platform;
using namespace Windows::Foundation;
using namespace Windows::Foundation::Collections;
using namespace Windows::UI::Xaml;
using namespace Windows::UI::Xaml::Controls;
using namespace Windows::UI::Xaml::Controls::Primitives;
using namespace Windows::UI::Xaml::Data;
using namespace Windows::UI::Xaml::Input;
using namespace Windows::UI::Xaml::Media;
using namespace Windows::UI::Xaml::Navigation;


MainPage::MainPage()
{
	InitializeComponent();
}


void Audi::MainPage::comboBox_SelectionChanged(Platform::Object^ sender Windows::UI::Xaml::Controls::SelectionChangedEventArgs^ e)
{

}

void Audi::MainPage::addObj(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
{
	//create image here
}
0 Upvotes

0 comments sorted by