|
7 | 7 | #include "ReactPickerView.g.cpp" |
8 | 8 |
|
9 | 9 | #include <winrt/Windows.Foundation.Metadata.h> |
10 | | -#include <winrt/Windows.UI.Xaml.Input.h> |
| 10 | +#include <UI.Xaml.Input.h> |
11 | 11 |
|
12 | 12 | namespace winrt { |
13 | 13 | using namespace Microsoft::ReactNative; |
14 | 14 | using namespace Windows::Foundation; |
15 | 15 | using namespace Windows::Foundation::Metadata; |
16 | | - using namespace Windows::UI; |
17 | | - using namespace Windows::UI::Xaml; |
18 | | - using namespace Windows::UI::Xaml::Controls; |
19 | | - using namespace Windows::UI::Xaml::Input; |
20 | | - using namespace Windows::UI::Xaml::Media; |
| 16 | + using namespace xaml; |
| 17 | + using namespace xaml::Controls; |
| 18 | + using namespace xaml::Input; |
| 19 | + using namespace xaml::Media; |
21 | 20 | } // namespace winrt |
22 | 21 |
|
23 | 22 | namespace winrt::ReactNativePicker::implementation { |
24 | 23 |
|
| 24 | +#ifdef USE_WINUI3 |
| 25 | + const bool ReactPickerView::s_isEditableComboboxSupported = true; |
| 26 | +#else |
25 | 27 | const bool ReactPickerView::s_isEditableComboboxSupported = winrt::ApiInformation::IsPropertyPresent( |
26 | | - L"Windows.UI.Xaml.Controls.ComboBox", L"IsEditableProperty"); |
| 28 | + L"Windows.UI.Xaml.Controls.ComboBox", L"IsEditableProperty"); |
| 29 | +#endif |
27 | 30 |
|
28 | 31 | ReactPickerView::ReactPickerView(winrt::IReactContext const& reactContext) : m_reactContext(reactContext) { |
29 | 32 | this->AllowFocusOnInteraction(true); |
@@ -64,9 +67,13 @@ namespace winrt::ReactNativePicker::implementation { |
64 | 67 | this->ClearValue(winrt::ComboBox::IsEditableProperty()); |
65 | 68 | } |
66 | 69 | else { |
67 | | - if (auto iComboBox6 = this->try_as<winrt::Controls::IComboBox6>()) { |
68 | | - iComboBox6.IsEditable(propertyValue.AsBoolean()); |
69 | | - } |
| 70 | +#ifdef USE_WINUI3 |
| 71 | + this->IsEditable(propertyValue.AsBoolean()); |
| 72 | +#else |
| 73 | + if (auto iComboBox6 = this->try_as<winrt::Controls::IComboBox6>()) { |
| 74 | + iComboBox6.IsEditable(propertyValue.AsBoolean()); |
| 75 | + } |
| 76 | +#endif |
70 | 77 | } |
71 | 78 | } |
72 | 79 | } |
@@ -191,7 +198,7 @@ namespace winrt::ReactNativePicker::implementation { |
191 | 198 | } |
192 | 199 | } |
193 | 200 |
|
194 | | - void ReactPickerView::UpdateComboBoxItemForegroundResource(winrt::FrameworkElement const& item, winrt::Windows::UI::Xaml::Media::Brush const& color) { |
| 201 | + void ReactPickerView::UpdateComboBoxItemForegroundResource(winrt::FrameworkElement const& item, xaml::Media::Brush const& color) { |
195 | 202 | if (auto comboBoxItem = item.try_as<winrt::ComboBoxItem>()) { |
196 | 203 | comboBoxItem.Foreground(color); |
197 | 204 | } |
|
0 commit comments