-
Notifications
You must be signed in to change notification settings - Fork 500
/
Copy pathScenario6.xaml.cpp
84 lines (69 loc) · 2.69 KB
/
Scenario6.xaml.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
//*********************************************************
//
// Copyright (c) Microsoft. All rights reserved.
// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
//
//*********************************************************
//
// Scenario6.xaml.cpp
// Implementation of the Scenario6 class
//
#include "pch.h"
#include "Scenario6.xaml.h"
using namespace SDKSample::WebViewControl;
using namespace Windows::Foundation;
using namespace Windows::UI::Xaml;
using namespace Windows::UI::Xaml::Controls;
using namespace Windows::UI::Xaml::Media;
using namespace Windows::UI::Xaml::Navigation;
Scenario6::Scenario6()
{
InitializeComponent();
}
// Invoked when this page is about to be displayed in a Frame.
void Scenario6::OnNavigatedTo(NavigationEventArgs^ e)
{
// A pointer back to the main page. This is needed if you want to call methods in MainPage such
// as NotifyUser()
rootPage = MainPage::Current;
// Select on of the items in the ComboBox
ComboBox1->SelectedIndex = 0;
// Ensure that our Rectangle used to simulate the WebView is not shown initially
Rect1->Visibility = Windows::UI::Xaml::Visibility::Collapsed;
WebView6->Navigate(ref new Uri("http://www.bing.com"));
}
// Click handler for the 'Solution' button.
void SDKSample::WebViewControl::Scenario6::Solution_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
{
Rect1->Visibility = Windows::UI::Xaml::Visibility::Visible;
}
/// <summary>
/// When the ComboBox opens we have an airspace conflict and the ComboBox cannot render its content over
/// the WebView. Therefore, we create a WebViewBrush and set the WebView as its source and call the Redraw() method
/// which will take a visual snapshot of the WebView. We then use that brush to fill our Rectangle.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
//<snippetWebViewBrushCode>
void SDKSample::WebViewControl::Scenario6::ComboBox1_DropDownOpened(
Platform::Object^ sender, Platform::Object^ e)
{
if (Rect1->Visibility == Windows::UI::Xaml::Visibility::Visible)
{
WebViewBrush^ b = ref new WebViewBrush();
b->SourceName = "WebView6";
b->Redraw();
Rect1->Fill = b;
WebView6->Visibility = Windows::UI::Xaml::Visibility::Collapsed;
}
}
void SDKSample::WebViewControl::Scenario6::ComboBox1_DropDownClosed(
Platform::Object^ sender, Platform::Object^ e)
{
WebView6->Visibility = Windows::UI::Xaml::Visibility::Visible;
Rect1->Fill = ref new SolidColorBrush(Windows::UI::Colors::Transparent);
}
//</snippetWebViewBrushCode>