forked from microsoft/microsoft-ui-xaml
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathItemsRepeater.common.cpp
49 lines (38 loc) · 1.62 KB
/
ItemsRepeater.common.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
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
#include <pch.h>
#include <common.h>
#include "ItemsRepeater.common.h"
#include "LifetimeHandler.h"
/* static */
winrt::Rect CachedVisualTreeHelpers::GetLayoutSlot(winrt::FrameworkElement const& element)
{
auto instance = LifetimeHandler::GetCachedVisualTreeHelpersInstance();
MUX_ASSERT(instance);
if (!instance->m_layoutInfo)
{
instance->m_layoutInfo = winrt::get_activation_factory<winrt::LayoutInformation, winrt::ILayoutInformationStatics>();
}
return instance->m_layoutInfo.GetLayoutSlot(element);
}
/* static */
winrt::DependencyObject CachedVisualTreeHelpers::GetParent(winrt::DependencyObject const& child)
{
auto instance = LifetimeHandler::GetCachedVisualTreeHelpersInstance();
MUX_ASSERT(instance);
if (!instance->m_visualTreeHelper)
{
instance->m_visualTreeHelper = winrt::get_activation_factory<winrt::VisualTreeHelper, winrt::IVisualTreeHelperStatics>();
}
return instance->m_visualTreeHelper.GetParent(child);
}
winrt::IDataTemplateComponent CachedVisualTreeHelpers::GetDataTemplateComponent(winrt::UIElement const& element)
{
auto instance = LifetimeHandler::GetCachedVisualTreeHelpersInstance();
MUX_ASSERT(instance);
if (!instance->m_xamlBindingHelperStatics)
{
instance->m_xamlBindingHelperStatics = winrt::get_activation_factory<winrt::XamlBindingHelper, winrt::IXamlBindingHelperStatics>();
}
return instance->m_xamlBindingHelperStatics.GetDataTemplateComponent(element);
}