Checked already asked questions but coudn't find a solution to this.
I am trying to reproduce the example provided in https://docs.microsoft.com/en-us/uwp/api/Windows.UI.Xaml.Media.Animation.RepositionThemeAnimation?redirectedfrom=MSDN&view=winrt-22000
<Page
x:Class="ButtonApp.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:ButtonApp"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Grid>
<Grid.Resources>
<!--Sets up a RepositionThemeAnimation using the FromHorizontalOffset property
to start the animation from the old location.-->
<Storyboard x:Name="PointerReleasedStoryboard">
<RepositionThemeAnimation Storyboard.TargetName="myRectangle" FromHorizontalOffset="-400"/>
</Storyboard>
</Grid.Resources>
<Rectangle x:Name="myRectangle"
HorizontalAlignment="Left"
Width="200"
Height="200"
Fill="Blue"
PointerReleased="myRectangle_PointerReleased"
/>
</Grid>
</Page>
In MainPage.h I added
#pragma once
#include "MainPage.g.h"
namespace winrt::ButtonApp::implementation
{
struct MainPage : MainPageT<MainPage>
{
MainPage();
int32_t MyProperty();
void MyProperty(int32_t value);
void myRectangle_PointerReleased(winrt::Windows::Foundation::IInspectable const& sender,
winrt::Windows::UI::Xaml::Input::PointerRoutedEventArgs const& e);
};
}
namespace winrt::ButtonApp::factory_implementation
{
struct MainPage : MainPageT<MainPage, implementation::MainPage>
{
};
}
In MainPage.cpp
#include "pch.h"
#include "MainPage.h"
#include "MainPage.g.cpp"
using namespace winrt;
using namespace Windows::UI::Xaml;
using namespace Windows::UI::Xaml::Media::Animation;
namespace winrt::ButtonApp::implementation
{
MainPage::MainPage()
{
InitializeComponent();
}
int32_t MainPage::MyProperty()
{
throw hresult_not_implemented();
}
void MainPage::MyProperty(int32_t /* value */)
{
throw hresult_not_implemented();
}
}
void winrt::ButtonApp::implementation::MainPage::myRectangle_PointerReleased(winrt::Windows::Foundation::IInspectable const& sender,
winrt::Windows::UI::Xaml::Input::PointerRoutedEventArgs const& e)
{
myRectangle().Margin({ 400, 0, 0, 0 });
PointerReleasedStoryboard().Begin();
}
pch.h file:
#pragma once
#include <windows.h>
#include <unknwn.h>
#include <restrictederrorinfo.h>
#include <hstring.h>
#include <winrt/Windows.Foundation.h>
#include <winrt/Windows.Foundation.Collections.h>
#include <winrt/Windows.ApplicationModel.Activation.h>
#include <winrt/Windows.UI.Xaml.h>
#include <winrt/Windows.UI.Xaml.Controls.h>
#include <winrt/Windows.UI.Xaml.Controls.Primitives.h>
#include <winrt/Windows.UI.Xaml.Data.h>
#include <winrt/Windows.UI.Xaml.Interop.h>
#include <winrt/Windows.UI.Xaml.Markup.h>
#include <winrt/Windows.UI.Xaml.Navigation.h>
#include <winrt/Windows.UI.Xaml.Media.Animation.h>
#include <winrt/Windows.UI.Xaml.Shapes.h>
Not sure what is missing I am getting this error
Severity Code Description Project File Line Suppression State
Error LNK2019 unresolved external symbol "public: __thiscall winrt::Windows::UI::Xaml::Input::PointerEventHandler::PointerEventHandler<class <lambda_304a3567805bccbaf9da8ada06fcdf84> >(class <lambda_304a3567805bccbaf9da8ada06fcdf84>)" (??$?0V<lambda_304a3567805bccbaf9da8ada06fcdf84>@@@PointerEventHandler@Input@Xaml@UI@Windows@winrt@@QAE@V<lambda_304a3567805bccbaf9da8ada06fcdf84>@@@Z) referenced in function "public: void __thiscall winrt::ButtonApp::implementation::MainPageT<struct winrt::ButtonApp::implementation::MainPage>::Connect(int,struct winrt::Windows::Foundation::IInspectable const &)" (?Connect@?$MainPageT@UMainPage@implementation@ButtonApp@winrt@@$$V@implementation@ButtonApp@winrt@@QAEXHABUIInspectable@Foundation@Windows@4@@Z) ButtonApp D:\ButtonApp\XamlTypeInfo.g.obj 1
CodePudding user response:
Thanks for the help folks.
I added a missing "#include <winrt/Windows.UI.Xaml.Input.h>" to the pch.h and it worked.