Struggling to integrate the title bar in a UWP project using JavaScript/CSS/HTML and having trouble accessing the necessary APIs. Came across a custom helper class written in c++ in UWP samples on Github, but unable to reference it in my javascript code. Here's how my project is structured:
https://i.sstatic.net/11LUe.jpg
And this is my javascript code:
(function () {
setupPanel();
configTitlebar();
})();
function setupPanel() {
Windows.UI.ViewManagement.ApplicationView.preferredLaunchViewSize = { width: 700, height: 320 };
Windows.UI.ViewManagement.ApplicationView.preferredLaunchWindowingMode = Windows.UI.ViewManagement.ApplicationViewWindowingMode.preferredLaunchViewSize;
}
function configTitlebar() {
var titleBar = Windows.UI.ViewManagement.ApplicationView.getForCurrentView().titleBar;
titleBar.backgroundColor = { a: 0, r: 255, g: 255, b: 255 };
titleBar.foregroundColor = { a: 255, r: 255, g: 255, b: 255 };
titleBar.buttonBackgroundColor = { a: 0, r: 255, g: 255, b: 255 };
titleBar.buttonForegroundColor = { a: 255, r: 255, g: 255, b: 255 };
var titleBarHelper = CoreViewHelpers.CoreTitleBarHelper.getForCurrentView();
var extend = extendView.checked;
titleBarHelper.extendViewIntoTitleBar = extend;
}
Encountering an error when trying to reference CoreViewHelpers:
Unhandled exception at line 18, column 5 in ms-appx://3146901b-10fb-4c64-95cb-a923fbe5c04e/js/main.js
0x800a1391 - JavaScript runtime error: 'CoreViewHelpers' is not defined
Attempting to gather information from Microsoft's Github sample here: https://github.com/Microsoft/Windows-universal-samples/tree/master/Samples/TitleBar/js